[RFH] EURO tweaks 2: problems with wchar_t

Ulrich Drepper drepper@redhat.com
Sun Apr 21 13:23:00 GMT 2002


On Sun, 2002-04-21 at 02:30, Paolo Carlini wrote:

>   if (__len)
>     {
>       ++__len;
>       memset(&__state, 0, sizeof(mbstate_t));
>       wchar_t* __wcs = (wchar_t*) malloc(sizeof(wchar_t) * __len);
>       __len2 = mbsrtowcs(__wcs, &__ccurr, __len, &__state);
>       _M_curr_symbol = __wcs;
>     }

You cannot use mbsrtwcs here.  The locale which is used for it is the
"C" locale which doesn't know any non-ASCII characters.

Either you add

   setlocale (LC_ALL, _s);

before the mbsrtowcs call or you wait until the uselocale function is
implemented and use that.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20020421/97d2b490/attachment.sig>


More information about the Libc-alpha mailing list