|
Boost : |
Subject: Re: [boost] [Locale] Preview of 3rd version
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-09-11 15:22:47
On 11/09/2010 19:30, Artyom wrote:
> Yes, are you using the latest version 2.x from sourceforge
> site or you had taken the "/trunk"? Because latest boost.locale
> sits in its own branch - rework.
I didn't use your library.
> What exactly did you seen? In what case? Do you save into file or into
> std::wcout?
do_in gets called in the file to memory case.
I'm talking of a codecvt facet that converts UTF-8 in files to UTF-16 in
memory.
The behaviour I've observed is the following: the implementation of
fstream in MSVC9 seems to call 'in' char per char, calling again and
appending one character when partial is returned.
Then, in case of 'ok', it just reads the first wchar_t written on the
output, and ignores the second that would be written in the case of
surrogates.
But then, looking at your library, you seem to do some weird (and
dangerous!) reinterpret casting, which suggests you're not making the
fstream interface directly with a std::codecvt<wchar_t, char,
std::mbstate_t> facet.
How did you make that work?
> Can you bring me the sample code that shows the issue?
Attached is a testcase that demonstrates the bug in MSVC9.
It prints "65 65 65 65 65" instead of "65 66 65 66 65 66 65 66 65 66".
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk