Web lists-archives.com

[Mingw-users] using mblen in windows




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.
------------------------------------------------------------------------------
_______________________________________________
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