John do you know if this also switches a console window into utf8 for such a 
launcher? (And if so, also for a already open console?)

The problem will be similar to initial jep400 that some still might need to 
know the legacy ansi codepage for the OS, and I guess the new method won’t give 
us that if the manifest is changed?

--
https://Bernd.eckenfels.net
________________________________
From: core-libs-dev <core-libs-dev-r...@openjdk.java.net> on behalf of Naoto 
Sato <naoto.s...@oracle.com>
Sent: Monday, October 4, 2021 10:23:47 PM
To: core-libs-dev@openjdk.java.net <core-libs-dev@openjdk.java.net>
Subject: Re: Windows 10 (since Windows 10 version 1903) and Windows 11 support 
UTF-8 as the default codepage through an executable manifest option

Hi John,

Please see the JEP 400, which changes the default charset to UTF-8
across platforms:

https://openjdk.java.net/jeps/400

HTH,
Naoto

On 10/4/21 8:47 AM, John Platts wrote:
> Windows 10 (since Windows 10 version 1903) and Windows 11 support UTF-8 as 
> the default codepage by setting an option in the application manifest.
>
> To enable UTF-8 as the default codepage for JDK executables on Windows 10 
> (starting with the May 2019 update) and Windows 11, the following 
> modifications can be made to the 
> src/java.base/windows/native/launcher/java.manifest file (or the 
> jdk/src/windows/resource/java.manifest in JDK 8):
>    ...
>    <!-- Indicate JDK is high-dpi aware and enable UTF-8 as the default 
> codepage on Windows 10 version 1903 and later. -->
>    <asmv3:application>
>      <asmv3:windowsSettings 
> xmlns:dpi1="http://schemas.microsoft.com/SMI/2005/WindowsSettings";
>                             
> xmlns:dpi2="http://schemas.microsoft.com/SMI/2016/WindowsSettings";
>                             
> xmlns:utf8="http://schemas.microsoft.com/SMI/2019/WindowsSettings";>
>        <dpi1:dpiAware>true/PM</dpi1:dpiAware>
>        <dpi2:dpiAwareness>PerMonitorV2, PerMonitor, system</dpi2:dpiAwareness>
>        <utf8:activeCodePage>UTF-8</utf8:activeCodePage>
>      </asmv3:windowsSettings>
>    </asmv3:application>
>    ...
>
> The GetACP() and GetOEMCP() API's will both return 65001 on Windows 10 
> Version 1903 or later if <utf8:activeCodePage>UTF-8</utf8:activeCodePage> 
> element is added to the executable manifest.
>
> GetLocaleInfo(lcid, LOCALE_IDEFAULTANSICODEPAGE, ret+2, 14) will return 
> different results from GetACP() if 
> <utf8:activeCodePage>UTF-8</utf8:activeCodePage> is present in the executable 
> manifest, and java.nio.charset.Charset.defaultCharset() should return 
> StandardCharsets.UTF_8 on Windows platforms if GetACP() returns 65001.
>

Reply via email to