This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFH] Trouble with mbsrtowcs and "\244" (Euro symbol)


Martin v. Loewis wrote:

>>What does 6384 mean?
>>    
>>
>
>Are you sure you are not getting 8364 instead? This is U+20AC, which is
>
><U20AC>     /xa4         EURO SIGN
>
>(from /usr/share/i18n/charmaps/ISO-8859-15.gz)
>
>Why is it unexpected for you that the currency symbol is the EURO SIGN
>in the de_DE@euro locale?
>
>Or, why is it unexpected to you that the euro sign has the Unicode
>ordinal 8364?
>
>IOW: What are you trying to do that these numbers matter? (I'm really
>curious)
>
Thanks Martin and Ulrich for your feedback. Indeed, what I'm getting is 
8364, sorry for the typo.

Now, what I'm doing with this? It's just a testcase for the 
libstdc++-v3. Something like this (if you want to try it with gcc3.1, 
please add the setlocale call, due to a bug still not fixed in the branch):

#include <locale>
#include <sstream>
#include <cassert>

int main()
{
  using namespace std;
  typedef ostreambuf_iterator<wchar_t> iterator_type;
  // setlocale(LC_ALL, "de_DE@euro");
  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");
}

I wrote the testcase dumbly copying it from the corresponding char case, 
that is simply prepending L to the expected result4. But now I see that 
this is incorrect since, according to Unicode Euro is 8364. Therefore, I 
suppose, in preparing this kind of testcase, the last char should be 
compared separately from the former.

Thoughts?

Thanks again,
Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]