[haiku-3rdparty-dev] Re: utf-8 to wide-char failing

  • From: Pete Goodeve <pete.goodeve@xxxxxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Thu, 27 Sep 2012 18:27:13 -0700

OK, I've written a little test program that just prints out what mbrtowc
does with supplied inputs, and I get exactly the same effect: UTF-8
returns an error.  (The app also tests iconv, which seems to be fine)

I've tried various 'setlocale' calls at the start of the program, and they
change nothing.  Furthermore, if the code is like this:

        char * loc = setlocale(LC_CTYPE, "smurf");
        printf("setlocale returned '%s'\n", loc);

I get "smurf" returned!  According to the man page I found, setlocale
is supposed to return NULL if it can't find a valid locale, and I doubt
those little blue bugs have one!  So, hunh?

I'm not familiar at all with how locale is handled, so there may be
something wrong in my system.  The locales seem to be in
/boot/common/share/locale -- I assume this is correct.   I see no
"en" folder there, but I assume that's correct too?

        -- Pete --

Other related posts: