Article ID: 260818
Article Last Modified on 6/14/2006
APPLIES TO
- Microsoft Java Virtual Machine, when used with:
- Microsoft Windows 2000 Standard Edition
This article was previously published under Q260818
SYMPTOMS
When you use "JIS" Japanese character encoding on a 3200-series build of the Microsoft virtual machine (Microsoft VM), you might encounter an UnsupportedEncodingException when you use certain aliases. Note that you might have successfully used these aliases on earlier versions of the Microsoft VM. See the "More Information" section of this article for the specific aliases that cause this exception.
CAUSE
The UnsupportedEncodingException is not entirely accurate because the encoding itself is supported. However, some of the previously supported aliases are not. This is due to some missing entries in a table that maps aliases to encoder classes.
RESOLUTION
To work around this problem, for any JIS encoding aliases that fail specify "JIS" explicitly or an alias other than those listed in the "More Information" section of this article.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This bug has been verified to occur in the 3200 series of the Microsoft VM.
This problem was corrected in Windows 2000 Service Pack 1.
MORE INFORMATION
Steps to Reproduce Behavior
- Use the code sample provided in this section and change the second parameter in the call to the string constructor to equal one of the missing aliases listed after the code.
- Compile and run the code.
If the alias is missing from the table, you will get an UnsupportedCodingException.
- To prove that the encoding is supported, change the second parameter back to "JIS", and then recompile and run the code.
import java.io.UnsupportedEncodingException; public class EncodingTest { public static void main (String[] args) throws Exception { try { byte[] data = {(byte)'s',(byte)'t',(byte)'r',(byte)'i',(byte)'n',(byte)'g'}; String str = new String(data, "JIS"); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); System.in.read(); } } }
The following are the missing entries in the alias mapping table:
"iso-2022-jp" --> "JIS" "csiso2022jp" --> "JIS" "jis_encoding" --> "JIS" "csjisencoding" --> "JIS"
Also note that the following aliases in builds later than the 3200 series will be mapped to the MS932 encoding rather than "SJIS".
"shift_jis" --> "MS932" "ms_kanji" --> "MS932" "csshiftjis" --> "MS932" "windows-31j" --> "MS932" "cswindows31j" --> "MS932"
REFERENCES
For additional information about the latest service pack for Windows 2000, click the article number below to view the article in the Microsoft Knowledge Base:
260910 How to Obtain the Latest Windows 2000 Service Pack
For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:
Keywords: kbbug kbfix kbjavavm33xxfix kbwin2000sp1fix KB260818