Web lists-archives.com

Re: [Mingw-users] using mblen in windows




> From: fd fsa <turbocborland@xxxxxxxxx>
> Date: Mon, 29 Aug 2016 13:01:17 -0400
> 
> I have set my system locale to Korean in windows.
> and in test program 
> 
> void main()
> {
>     setlocale(LC_ALL, "korean");
> 
>     char *b = "한";
> 
>     mblen(NULL, MB_CUR_MAX);
>     printf("%d\n", mblen(b, MB_CUR_MAX));
>     printf("%d\n", strlen(b));
> }
> 
> C:\WINDOWS\system32\cmd.exe /c ( ^"mbstrlentest^" )
> -1
> 3
> shell returned 2
> Hit any key to close this window...
> 
> mblen seems to return incorrect multibyte length. if I set locale to Korean, is it even a multibyte coding? strlen
> says 3 bytes, so I assume it's multibyte.

How (in what codepage) did you encode your source file?  AFAIK, the
Korean codepage is 949, where the character you used is a 2-byte
sequence.  That in your case it used 3 bytes makes be suspect your
source file was encoded in UTF-8, which is not supported by Windows
mblen.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe