Bug#128026: libstdc++3: std::wcout does not perform encoding conversions
Package: libstdc++3
Version: 1:3.0.3-1
Severity: normal
Running the program
#include <iostream>
int main(){
std::locale loc("de_DE.UTF-8");
std::locale::global(loc);
std::wcout<<L"Der \u20AC ist da"<<std::endl;
}
results in output that represents, in binary, as
0000000 D e r ¬ i s t d a \n \0
6544 2072 20ac 7369 2074 6164 000a
0000015
As you can see, the non-ASCII character U+20AC (EURO SIGN) was printed
as a two-byte value in what appears to be UCS-2. Instead, conversion
to UTF-8 should have been performed. This happens in every locale; try
de_DE.iso-8859-15 for another example (where EURO SIGN should have been
converted to a single byte, /xa4).
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux kosh 2.4.13-586-ext3 #1 Die Nov 6 00:09:32 CET 2001 i686
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro
Versions of packages libstdc++3 depends on:
ii gcc-3.0-base 1:3.0.3-1 The GNU Compiler Collection (base
ii libc6 2.2.4-7 GNU C Library: Shared libraries an
ii libgcc1 1:3.0.3-1 GCC support library.
Reply to: