Boost logo

Boost Users :

Subject: Re: [Boost-users] encoding data when serializing
From: Sean Farrow (sean.farrow_at_[hidden])
Date: 2012-03-09 13:00:32


What is the name of the serialization codecvt class, and does the serialization library use utf8 chars even is you use wide char archives?
Cheers
San.

-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Robert Ramey
Sent: 09 March 2012 16:55
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] encoding data when serializing

Sean Farrow wrote:
> What does the facet need to do?
> Cheers
> Sean.
>

The facet transforms a stream of characters (wide or narrow) into another stream of characters (wide or narrow) and vice-versa. Once built it is threaded into the standard library stream via some standard library calls. This is a general mechanism for tranforming stream i/o from one representation to another.

For more information study the documentation for the standard library.

Also for an example, you can study the serialization library source code which uses this functionality to transform wide char i/o to
utf-8 i/o. The library also includes a codecvt facet for doing this which might be used as an example.

Basically, the designers of the C++ standard i/o forsaw exactly this situation and made provision for it. It's all in there, you just have to use it.

Note that this is note an issue having anything to do with the serialization library. It only seems that way because the serialization library uses stream i/o and hence will inherit any features of the stream which it uses.

If one had nothing else to do, he could make a boost library to help make and compose (stack) codecvt facets. Much (or all) of this functionality might overlap with the boost io streams library. Or it might not. I've only looked at the boost io streams library enough to know that it doesn't use codecvt facets. I asked at one time why this was so - but didn't get any response.

Robert Ramey

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net