This is the mail archive of the cygwin mailing list for the Cygwin 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: mbrtowc bug


On Jul 20 14:08, Corinna Vinschen wrote:
> On Jul 20 05:59, Eric Blake wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > According to Corinna Vinschen on 7/20/2009 5:55 AM:
> > > 
> > > What bug?!?  When I run this testcase on Cygwin 1.7, it returns 0.  What
> > > is the supposed error and what is expected if it's behaving correctly?
> > 
> > Hmm.  Here's what it did for me on Windows XP (maybe the bug is in the
> > underlying Windows functions, which has since been fixed in your Windows
> > version?)
> > 
> > Breakpoint 1, main () at foo.c:5
> > 5       {
> > (gdb) n
> > 6         if (setlocale (LC_ALL, "ja_JP.eucJP") != NULL)
> > (gdb)
> > 8             char input[] = "B\217\253\344\217\251\316er";
> > (gdb)
> > 13            memset (&state, '\0', sizeof (mbstate_t));
> > (gdb)
> > 14            if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
> > (gdb)
> > 16                input[1] = '\0';
> > (gdb)
> > 17                if (mbrtowc (&wc, input + 2, 5, &state) != 2)
> > (gdb)
> > 18                  return 1;
> > (gdb)
> 
> I'm running the testcase on XP SP3.  I have an idea why it fails for
> you.  The eucJP codepage 20932 is not installed by default on US and
> other western language systems by default up to Windows 2003.  What you
> have to do is, open the "Regional and Language Options" control panel,
> go to the "Advanced" tab, scroll the "Code page conversion tables" list
> down to the 20932 entry, select it and install it.
> 
> This is not necessary anymore startying with Vista, which comes with
> almost all important conversion tables preinstalled.

Btw., this is only a problem for the codepages 932 (SJIS), 936 (GBK),
949 (eucKR), 950 (Big5), and 20932 (eucJP).  These codepages need OS
support in the current implementation.  We could get rid of that if
we had our own conversion routines to Unicode and vice versa.
This is a sure http://cygwin.com/acronyms/#PTC case.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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