Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2021 closed Bugs (wontfix)

Multibyte conversion on wide strings fails on systems with incorrect locale

Reported by: robert.bielik@… Owned by: Robert Ramey
Milestone: Boost 1.36.0 Component: serialization
Version: Boost 1.34.1 Severity: Showstopper
Keywords: Cc:

Description

When saving std::wstring with Japanese chars on an English system, std::wctomb fails (due to incorrect locale). The conversion should be done to UTF-8 instead which is locale-independent. For workaround I now store std::string with UTF-8 encoding.

Change History (3)

comment:1 by Robert Ramey, 14 years ago

which archive class do you use. Have you tried archive_wtext ?

Robert Ramey

comment:2 by Robert Ramey, 14 years ago

Resolution: wontfix
Status: newclosed

Hmmm - seems to me that this is trapping a user error. If the currently set locale can't handle the particular wstring - change the locale before you serialize. Maybe what you want is a "utf8 locale" if such a thing makes sense.

Trying to fix this within the library would be in sync with the current popular style of making "smart" software, but leads to software with surprising behavior.

No change planned for this.

Robert Ramey

comment:3 by robert.bielik@…, 14 years ago

I cannot see how a standard locale independent UTF-8 encoding would lead to "surprising behavior"? Instead it would be consistent and expected behaviour on all locales and platforms with no surprises like this.

Note: See TracTickets for help on using tickets.