Subject: Re: [boost] Utf8_codecvt_facet for UTF-16
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2009-02-06 13:39:52


Eric MALENFANT wrote:
> frederic.bron wrote:
>> Thanks for the advice but I have absolutely no idea of how to
>> use wide characters. I have never used them. C++ standard
>> does not say what can be done with wide characters. For
>> example how can I read properly a file written in UTF8?
>
> I wanted to reply:
> std::wifstream f("AFileInUtf8.txt");
> f.imbue(std::locale(std::locale(), new
> boost::utf8_codecvt_facet<wchar_t>);
>
> But it seems that the codecvt_facet in
> boost/libs/detail/utf8_codecvt_facet.cpp only supports UTF-8<=>UCS-4
> conversions.
> It thus seems that it can't be used with wchar_t on a platform where
> sizeof(wchar_t) != 4, right?
>
> Am I missing something?

There's a similar codecvt_facet in the serialization library under the
archive details. Perhaps it can be used?

Jeff