Re: unicode file
- From: "Tom Serface" <tom.nospam@xxxxxxxxxxxxx>
- Date: Sun, 22 Jun 2008 17:52:07 -0700
Thanks for that information Mihai. If it works, that would be a great addition to the library...
I appreciate the link.
Tom
"Mihai N." <nmihai_year_2000@xxxxxxxxx> wrote in message news:Xns9AC67703E353MihaiN@xxxxxxxxxxxxxxxx
how can now if the file is unicode or ansi
and if is ansi how can i convert it to unicode
Adding even more to the answers from Tom and Giovanni :-)
If you use a VS8, take a loot at _open:
http://msdn.microsoft.com/en-us/library/z0kc8e3z(VS.80).aspx
You can specify _O_TEXT, _O_U16TEXT, _O_U8TEXT or _O_WTEXT
And the nicest part about _O_WTEXT:
"If _O_WTEXT is used to open a file for reading, _open reads the
beginning of the file and check for a byte order mark (BOM).
If there is a BOM, the file is treated as UTF-8 or UTF-16LE
depending on the BOM. If no BOM is present, the file is treated
as ANSI. When a file is opened for writing using _O_WTEXT, UTF-16
is used. If _O_UTF8 is used, the file is always opened as UTF-8
and if _O_UTF16 is used, the file is always opened as UTF-16
regardless of any previous setting or byte order mark."
No extra libraries (sorry Giovanni :-) and no need to do your own conversion
(sorry Tom :-)
--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
.
- References:
- Re: unicode file
- From: Mihai N.
- Re: unicode file
- Prev by Date: Re: How to get local computer My Document FULL path?
- Next by Date: Re: WM_COPYDATA between two applications
- Previous by thread: Re: unicode file
- Next by thread: Help is restoring MS exchange 2003 programmatically?
- Index(es):
Relevant Pages
|