]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
windows: Support UTF-8 locale 1043/head
authorJohn Starks <jostarks@microsoft.com>
Mon, 23 Jul 2018 22:37:09 +0000 (15:37 -0700)
committerJohn Starks <jostarks@microsoft.com>
Wed, 25 Jul 2018 20:02:00 +0000 (13:02 -0700)
Newer versions of the Windows CRT can return locales that are suffixed
with .utf8 instead of an integer code page.

libarchive/archive_string.c

index 554533ecb91bd0266602c26a823b391d03c946a5..18ad82d1e85f69f652b297379d82a92223f08c0d 100644 (file)
@@ -1512,8 +1512,10 @@ get_current_codepage(void)
        p = strrchr(locale, '.');
        if (p == NULL)
                return (GetACP());
+       if (strcmp(p+1, "utf8") == 0)
+               return CP_UTF8;
        cp = my_atoi(p+1);
-       if (cp <= 0)
+       if ((int)cp <= 0)
                return (GetACP());
        return (cp);
 }