As I emphasize *piece by piece* in the question, I have to read the ANSI file piece by piece to conserve resources, say 40 kilobytes for each read.
Now I am handling an ANSI file that contains Chinese characters (encoded using the GBK charset, two bytes for each Chinese character and one byte for each ASCII character).
I want to convert the ANSI file to Unicode, this can be easily done using the Win32 API MultiByteToWideChar (I am on Windows Mobile), the problem is if I read the file piece by piece, I will have many chances to read half of a Chinese character. How do I avoid that?
Thank you in advance!
-- Kevin Tse