unicode charaters

Does anyone know how do I read UNICODE character from a text file and write it to another file. Because I have problems reading/writing non ASCII characters like: s,o, etc.




Answer this question

unicode charaters

  • Omar AlAmoudi

    You need to know the encoding of the file you're reading. Non-ASCII characters may be encoded in a variety of ways, not necessarily Unicode.

    The .NET file methods already default to UTF-8 so if that doesn't work you may want to try the Windows 1252 code page (the most likely encoding for German language text).

  • John Ericson174499

    I'm using this:

    StreamReader reader = new StreamReader(filename, Encoding.Default);

     


    Or be explicit about it: Encoding.GetEncoding(1252)



  • Tosch

    Thanks for your reply Chris.

    I am reading from a "csv"(comma separated values) file, which was generated from Excel. How do I set the Windows 1252 code


  • unicode charaters