Yan Cheng CHEOK wrote: > Currently, I have the following text file > (https://sites.google.com/site/yanchengcheok/Home/TEST.TXT?attredirects=0&d=1) > written by C++ wostringstream.
Stringstream? I guess you meant wofstream, or? Anyway, the output encoding of C++ iostreams is implementation-defined, so you can't assume that such code is generally portable. If you want a certain encoding, you need to tell the ofstream using the codecvt facet of the locale, a websearch should turn up more info on that. If you have the data in memory and it is encoded as UTF-16 there (which is what MS Windows uses for its wchar_t) then you could also use a plain ofstream, open it with the binary flag and then simply write the memory to a file. In any case, you need to know the encoding in order to get the content into a Python string or unicode object, otherwise you will only get garbage. Good luck! Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list