Codereview request for 4153167: separate between ANSI and OEM code pages on Windows

Tom Hawtin tom.hawtin at oracle.com
Fri Feb 17 15:35:13 UTC 2012


On 16/02/2012 20:18, Xueming Shen wrote:
> Thanks Alan, webrev has been updated accordingly.
>
> http://cr.openjdk.java.net/~sherman/4153167/webrev
> <http://cr.openjdk.java.net/%7Esherman/4153167/webrev/>

Although it's in some sense safe in this case, you might get a grumble 
about introducing a new sprintf.

+static char* getConsoleEncoding()
+{
+    char* buf = malloc(16);
+    int cp = GetConsoleCP();
+    if (cp >= 874 && cp <= 950)
+        sprintf(buf, "ms%d", cp);
+    else
+        sprintf(buf, "cp%d", cp);
+    return buf;
+}

Tom



More information about the core-libs-dev mailing list