Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinguishing UNICODE and ASCII text files 1

Status
Not open for further replies.

jonpw

Programmer
Joined
May 14, 2001
Messages
1
Location
GB
Well, here's another UNICODE problem!

I need to be able to read/write UNICODE text files.

I am being particularly lazy at the moment and just using CStdioFile::ReadString() which works fine with plain old ASCII, but spits the dummy with UNICODE files!

- yes my program is compiled with _UNICODE
- my OS is WinXP, and its configured correctly so I can see Japanese/Chinese etc.

So now the questions:
1) does anyone know if CStdioFile will cope with UNICODE text files?
2) does anyone know how to programmatically distinguish UNICODE files from ASCII text files?

Thanks for your help.
 
Once you have read your file you need to check to see if the byteorder mark is set in the file.

You can use the IsTextUnicode(...) function to do this.

HTH

William
Software Engineer
ICQ No. 56047340
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top