This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/6410: Troble with non-Ascii monetary symbols and wchar_t
- From: pcarlini at unitus dot it
- To: gcc-gnats at gcc dot gnu dot org
- Date: 22 Apr 2002 17:22:19 -0000
- Subject: libstdc++/6410: Troble with non-Ascii monetary symbols and wchar_t
- Reply-to: pcarlini at unitus dot it
>Number: 6410
>Category: libstdc++
>Synopsis: Troble with non-Ascii monetary symbols and wchar_t
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 22 10:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Paolo Carlini
>Release: 3.1 20020417
>Organization:
>Environment:
x86-linux, glibc2.2.5 (gnu locale model)
>Description:
Trying to fix the testsuite to work well with the new EURO localedata (present in glibc CVS, both 2.2 and mainline) exposed what seems to be a problem with non-Ascii monetary symbols and wchar_t.
This is a testcase:
#include <locale>
#include <sstream>
#include <cassert>
int main()
{
using namespace std;
typedef ostreambuf_iterator<wchar_t> iterator_type;
locale loc_de("de_DE@euro");
const wstring empty;
const wstring digits1(L"720000000000");
wostringstream oss;
oss.imbue(loc_de);
const money_put<wchar_t>& mon_put = use_facet<money_put<wchar_t> >(oss.getloc());
oss.setf(ios_base::showbase);
oss.str(empty);
iterator_type os_it04 = mon_put.put(oss.rdbuf(), false, oss, ' ', digits1);
wstring result4 = oss.str();
assert( result4 == L"7.200.000.000,00 \244");
}
>How-To-Repeat:
>Fix:
Most probably, the culprit is the use of mbsrtowcs in config/locale/gnu/monetary_members.cc, which actually needs an appropriate setlocale in order to deal correctly with non-Ascii chars.
>Release-Note:
>Audit-Trail:
>Unformatted: