<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
The issue can be worked around on Windows 10 Version 1903 or later (including Windows 11) by modifying the src/java.base/windows/native/launcher/java.manifest file as follows:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0 ContentPasted1">
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<div class="ContentPasted1"><assembly xmlns="urn:schemas-microsoft-com:asm.v1"</div>
<div class="ContentPasted1">          manifestVersion="1.0"</div>
<div class="ContentPasted1">          xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"</div>
<div class="ContentPasted1">></div>
<div class="ContentPasted1"><assemblyIdentity</div>
<div class="ContentPasted1">    name=""</div>
<div class="ContentPasted1">    version=""</div>
<div class="ContentPasted1">    processorArchitecture="X86"</div>
<div class="ContentPasted1">    type="win32"</div>
<div class="ContentPasted1">/></div>
<div class="ContentPasted1"><description>Java(TM) SE process</description></div>
<div class="ContentPasted1"><dependency></div>
<div class="ContentPasted1">    <dependentAssembly></div>
<div class="ContentPasted1">        <assemblyIdentity</div>
<div class="ContentPasted1">            type="win32"</div>
<div class="ContentPasted1">            name="Microsoft.Windows.Common-Controls"</div>
<div class="ContentPasted1">            version="6.0.0.0"</div>
<div class="ContentPasted1">            processorArchitecture="*"</div>
<div class="ContentPasted1">            publicKeyToken="6595b64144ccf1df"</div>
<div class="ContentPasted1">            language="*"</div>
<div class="ContentPasted1">        /></div>
<div class="ContentPasted1">    </dependentAssembly></div>
<div class="ContentPasted1"></dependency></div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1">  <!-- Identify the application security requirements. --></div>
<div class="ContentPasted1">  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"></div>
<div class="ContentPasted1">    <security></div>
<div class="ContentPasted1">      <requestedPrivileges></div>
<div class="ContentPasted1">        <requestedExecutionLevel</div>
<div class="ContentPasted1">          level="asInvoker"</div>
<div class="ContentPasted1">          uiAccess="false"/></div>
<div class="ContentPasted1">        </requestedPrivileges></div>
<div class="ContentPasted1">       </security></div>
<div class="ContentPasted1">  </trustInfo></div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1">  <!-- Indicate JDK is high-dpi aware. --></div>
<div class="ContentPasted1">  <asmv3:application></div>
<div class="ContentPasted1">    <asmv3:windowsSettings xmlns:dpi1="http://schemas.microsoft.com/SMI/2005/WindowsSettings"</div>
<div class="ContentPasted1">                           xmlns:dpi2="http://schemas.microsoft.com/SMI/2016/WindowsSettings"</div>
<div class="ContentPasted1 ContentPasted2">                           xmlns:utf8="http://schemas.microsoft.com/SMI/2019/WindowsSettings"></div>
<div class="ContentPasted1">      <dpi1:dpiAware>true/PM</dpi1:dpiAware></div>
<div class="ContentPasted1">      <dpi2:dpiAwareness>PerMonitorV2, PerMonitor, system</dpi2:dpiAwareness></div>
<div class="ContentPasted1">      <!-- Use UTF-8 as the active code page on Windows 10 version 1903 or later --></div>
<div class="ContentPasted1 ContentPasted3">      <utf8:activeCodePage>UTF-8</utf8:activeCodePage><br>
</div>
<div class="ContentPasted1">    </asmv3:windowsSettings></div>
<div class="ContentPasted1">  </asmv3:application></div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1">  <!-- Indicate this JDK version is Windows 7 compatible --></div>
<div class="ContentPasted1">   <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"></div>
<div class="ContentPasted1">      <application></div>
<div class="ContentPasted1">        <!-- Windows Vista --></div>
<div class="ContentPasted1">        <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/></div>
<div class="ContentPasted1">        <!-- Windows 7 --></div>
<div class="ContentPasted1">        <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/></div>
<div class="ContentPasted1">        <!-- Windows 8 --></div>
<div class="ContentPasted1">        <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/></div>
<div class="ContentPasted1">        <!-- Windows 8.1 --></div>
<div class="ContentPasted1">        <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/></div>
<div class="ContentPasted1">        <!-- Windows 10 --></div>
<div class="ContentPasted1">        <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/></div>
<div class="ContentPasted1">      </application></div>
<div class="ContentPasted1">    </compatibility></div>
</assembly><br>
</div>
<div id="signature_bookmark"></div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof ContentPasted4">
The GetACP() and GetOEMCP() functions will both return 65001 on Windows 10 Version 1903 or later if the above changes are made to <span style="background-color:rgb(255, 255, 255);display:inline !important" class="ContentPasted5">src/java.base/windows/native/launcher/java.manifest.</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof ContentPasted6 ContentPasted7">
Also make sure that the sun.jnu.encoding property is set to UTF-8 if GetACP() returns 65001.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof ContentPasted6 ContentPasted7">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof ContentPasted6 ContentPasted7">
Note that it is possible for GetACP() and GetOEMCP() to return values other than 65001 on Windows 10 Version 1809 or earlier or if the JVM is embedded in an application that does not have the <span style="background-color:rgb(255, 255, 255);display:inline !important" class="ContentPasted8"><utf8:activeCodePage>UTF-8</utf8:activeCodePage>
 setting in its manifest.</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)" class="elementToProof">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> core-libs-dev <core-libs-dev-retn@openjdk.org> on behalf of Naoto Sato <naoto@openjdk.org><br>
<b>Sent:</b> Wednesday, September 28, 2022 1:03 PM<br>
<b>To:</b> core-libs-dev@openjdk.org <core-libs-dev@openjdk.org><br>
<b>Subject:</b> Re: RFR: 8293579: tools/jpackage/share/jdk/jpackage/tests/UnicodeArgsTest.java fails on Japanese Windows platform [v2]</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText elementToProof">On Wed, 28 Sep 2022 09:45:32 GMT, KIRIYAMA Takuya <duke@openjdk.org> wrote:<br>
<br>
>> Could you please review the JDK-8293579 bug fixes?<br>
>> <br>
>> tools/jpackage/share/jdk/jpackage/tests/UnicodeArgsTest.java attempts to give <br>
>> the launcher the character which is encoded by Windows API WideCharToMultiByte()
<br>
>> from UNICODE "иж"(0x00e9) as an argument. However, this test fails because the <br>
>> code point "иж"(0x00e9) cannot be treated on Japanese Windows.<br>
>> <br>
>> WideCharToMultiByte() encodes characters as Shift-JIS on Japanese Windows, but
<br>
>> the code point "иж"(0x00e9) does not exist in Shift-JIS, and it is replaced with
<br>
>> "e"(0x0065) as substitute. Therefore, "иж"(0x00e9) and "e"(0x0065) are compared
<br>
>> in this test and judged to be different characters, and return as failed.<br>
>> <br>
>> So, in the Japanese encoding("MS932", "SJIS"), the test should be modified to <br>
>> give a character such as "дв"(0x3042) as the launcher's argument instead of <br>
>> "иж"(0x00e9).<br>
><br>
> KIRIYAMA Takuya has updated the pull request incrementally with one additional commit since the last revision:<br>
> <br>
>   8293579: tools/jpackage/share/jdk/jpackage/tests/UnicodeArgsTest.java fails on Japanese Windows platform<br>
<br>
test/jdk/tools/jpackage/share/jdk/jpackage/tests/UnicodeArgsTest.java line 55:<br>
<br>
> 53:         String encoding = System.getProperty("native.encoding");<br>
> 54:         switch (encoding) {<br>
> 55:         default:<br>
<br>
What I meant by the previous comment was to replace this `default` clause to:<br>
<br>
    case "Cp1252", "UTF-8" -> testString = new String(Character.toChars(0x00E9));<br>
<br>
And for other unknown encodings:<br>
<br>
    default -> {<br>
        System.out.println("Test skipped"); // or better message<br>
        return;<br>
    }<br>
<br>
And your fix:<br>
<br>
    case "MS932", "SJIS" -> testString = new String(Character.toChars(0x3042));<br>
<br>
This way only the encodings that are guaranteed to succeed are tested.<br>
<br>
-------------<br>
<br>
PR: <a href="https://git.openjdk.org/jdk/pull/10226" data-auth="NotApplicable">https://git.openjdk.org/jdk/pull/10226</a><br>
</div>
</span></font></div>
</body>
</html>