0

Hi,
i cant seem to get my head around this 1. its about utf8 to u32 and vice versa.

I have a file which is written using a custom logic by someone else in vc++, and am reading the same in my c sharp application.

Initially while i was debugging the c++ code, i did find ,there was utf8 and unicode convertion happening while writing on to file, then now i could find there is also utf8 to u32 method.
My question is how do i do that in c sharp.

though, the logic i have written now is, a simple ascii encoding and reading a filestream using the GetString().
ascii supports only upto 0x7f, but i could see 0xA0 and0x8c in the files, could any1 please let me know how would i overcome this problem.

byte[] fileStream = File.ReadAllBytes(Path);
             ASCIIEncoding enc = new ASCIIEncoding();
            string first = enc.GetString(fileStream, 0, 70);

thanks in advance.

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by mcriscolo
0

You're almost there...

byte[] fileStream = File.ReadAllBytes(Path);
string first = Encoding.UTF8.GetString(fileStream, 0, 70);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.