Any text or text content that uses this character set / encoding!
According to Wikipedia , CP932 is a Shift JIS extension ... which is one of the character sets that is used to represent Japanese text.
According to this page , CP932 is located in "Advanced Encoding (contained in lib / charsets.jar)." If this is not in your OpenJDK installation, find the yum / apt / package of any OpenJDK that offers additional Java character set support. OpenJDK's CP932 support is definitely available somewhere ...
It is also possible (although IMO is unlikely) that OpenJDK does not recognize “cp932” as an alias for what it calls “MS932” and “windows-31j”.
I checked the code .
The problem is that Java (and not just OpenJDK!) Does not recognize the alias "cp932" at all. The reason it doesn't recognize is because the alias is non-standard .
The official (IANA approved) name for this encoding is "windows-31j", and Java also supports the following aliases by default:
- "MS932"
- windows 932
- "csWindows31J"
If you set the system property "sun.nio.cs.map" (i.e. using "-D ...") to "Windows-31J / Shift_JIS", then Java will also recognize "shift-jis", ms_kanji ", "x-sjis" and "csShiftJIS" are equivalent ... but this should only be used for backward compatibility with older (1.4.0 and earlier) JDKs that did not implement the real SHIFT-JIS encoding correctly, (Also, this is not solves your problem ...)
So what can you do?
- Reject / discard content as invalid. (And so it is.)
- Find out where this content comes from and ask them to fix the wrong encoding name.
- Intercept the encoding name in the Google code before trying to use it, and replace the non-standard name with the corresponding standard.
- Use the nasty reflective hacker to add an encoding alias to the private data structure that Oracle code uses to encode. (Warning: this can make your application fragile and lead to portability issues.)
- Raise RFE against Java SE by requesting an easy way to add aliases for character encoding. (This is a really long-term solution, although you can speed it up by writing and submitting the proposed enhancement to the OpenJDK team as a patch.)
source share