Re: wofstream
From: tom_usenet (tom_usenet_at_hotmail.com)
Date: 07/23/04
- Next message: Russell Hind: "Re: std::ofstreams and HANDLES in VC7.1"
- Previous message: Kostka, Volkmar: "Re: std::ofstreams and HANDLES in VC7.1"
- In reply to: Vladimir: "wofstream"
- Next in thread: Vladimir: "Re: wofstream"
- Reply: Vladimir: "Re: wofstream"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 23 Jul 2004 16:18:07 +0100
On Mon, 19 Jul 2004 12:34:56 +0400, "Vladimir" <voinkovv@mail.ru>
wrote:
>Hi all,
>
>I found that wide char file stream doesn't write national symbols. That is
>unlike narrow stream.
>Is it a bug or there is something I should know? I noticed also that the
>stream writes wide char
>as byte. Is it UTF8? How can I switch text encoding? Could you point me some
>docs or
>samples. Thanks!
To change the encoding you have to embue the filestream with a locale
that includes a codecvt facet for the conversion. Unfortunately, MSVC
doesn't come with any except the text one (that does \n \r\n
conversions), and the not very useful default wstream one which just
converts wchars to chars by chopping off the second byte!
The best solution is to buy Dinkumware's CoreX library
(www.dinkumware.com); it includes support for a huge number of
encodings. If that's not an option, and UTF8 is all you really need,
then you can download a UTF8 conversion facet from here:
http://www.rrsd.com/boost/index.htm
with docs here:
http://www.rrsd.com/boost/libs/serialization/doc/codecvt.html
Tom
- Next message: Russell Hind: "Re: std::ofstreams and HANDLES in VC7.1"
- Previous message: Kostka, Volkmar: "Re: std::ofstreams and HANDLES in VC7.1"
- In reply to: Vladimir: "wofstream"
- Next in thread: Vladimir: "Re: wofstream"
- Reply: Vladimir: "Re: wofstream"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|