JDK-8036628 : SJIS characters ending with 0x5c are passed incorrectly to a java-level argument
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 7u10
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2014-03-04
  • Updated: 2014-04-03
  • Resolved: 2014-03-25
Related Reports
Duplicate :  
In Windows platforms, Shift-JIS characters ending with 0x5c given as a
command line argument are passed incorrectly to a java-level argument. 

Confirmed that this is a duplicate of JDK-8016110

This is likely to be a duplicate of JDK-8016110

You can test using the following reproducer in a Command Prompt window. Reproducer: --- cmdargs.java --- import java.util.*; import java.io.*; public class cmdargs { public static void main(String[] args) { if (args.length == 0) { System.out.println("usage: java -cp . cmdargs cmd arg .."); System.exit(1); } for (int n = 0; n < args.length; n++) { System.out.print(args[n].length()); System.out.print(":"); System.out.println("[" + args[n] + "] "); } System.exit(0); } } --- Expected Behavior: C:\> java -cp . cmdargs "���\" "222" 1:[&#34920;] // 0x95 0x5c 3:[222] // 0x32 0x32 0x32 The first argument ������\���, which contains the character in question, is passed correctly as args[0]. Actual Behavior: C:\> java -cp . cmdargs "���\" "222" 5:[? 222] // 0x3f 0x20 0x32 0x32 0x32 The first argument ���&#34920;��� is passed correctly as args[0]. The problem does not occur on 6u65 and 7u9 (= expected behavior), but can reproduce on 7u10 and 7u51 (= actual behavior). Also the problem is always reproducible on those update release. system configuration ==================== java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) OS: Windows 7 SP1 (Japanese environment) Current code page by chcp: 932 The problem occurs on both x86 and x64. support work ============ The problem reproduces on builds starting with 7u10 ea b06. Reproducible conditions: - Typical Japanese Shift-JIS characters passed incorrectly are like below. ���\ (0x95 0x5c) ��\ (0x83 0x5c) ���\ (0x89 0x5c) ���\ (0x8b 0x5c) - The command line argument must be end with the character like above and also must be enclosed with double quotation marks. If the argument is not enclosed with double quotation characters, the problem does not occur. Examples included in bat file in reproducer attachment. I'm not seeing a difference between 7u9 and 7u10 as per suggestion from submitter. Will continue to investigate.