Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-06-30 22:50:15


William Kemper wrote:
> The fill method on mb_from_wchar calls std::wctomb, which is backed by
> 'WideCharToMultiByte'. This function uses the codepage defined in the
> current locale, however, the utf-8 codepage does not function properly
> on VC++ 7 or 8. Would it be difficult to have the conversion use the
> code_cvt facet defined for the stream underlying the archive?

I'm not sure how that would work. the streambuffer for text_?archive
takes multi-byte char as input while the one you need takes a wchar.

> It also seems that doing so would ensure serialization / deserialization
> would
> be more consistent and self-sufficient, since neither process would
> depend on a (mutable) global locale setting. At any rate, the
> serialization library works with certain window's codepages, but *not*
> with the utf-8 codepage (65001). It would be nice to have the library
> use its own utf8_code_cvt facet to translate wide characters to
> multibyte. If there is some work around I'm not aware of, I would
> appreciate any advice. Thanks.

This is a pretty tough one. I would think the base thing is to fix
the problem at its source. I'm not sure which locale uses utf-8
but in any case maybe you want to create a "correct locale"
based on the erroneious one. Then make the "correct locale"
the current one. THat would fix the problem for serialization
along with any other code that might be depending on
broken functionality.

Robert Ramey


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