What if my JRE does not support character encoding?

What if the file is created using an encoding that the JRE does not support? Is there a way to extend / customize what my JRE can handle?

This may be a terrible / irrelevant example (I just type in personal sets / encodings for the first time), but I believe that the Linux JRE does not handle CP-1252 (Windows encoding). If so, how can I get a Java application running on a Linux machine to read a CP-1252 encoded file?

Even if the Linux JRE distribution supports CP-1252 (which makes this terrible example), I know that there are encodings that it does not support. Whatever these encodings are, is there a way to extend the standard Charactset, and if so, how?

+5
source share
3 answers

The Java class library has a mechanism for adding character set support; see javadocs for CharsetProvider.

The basic idea is that you are writing a class that implements the API CharsetProvider. Then, in your JAR file, you add a file called "/META-INF/services/java.nio.charset.spi.CharsetProvider", which lists your symbol names in the prescribed format.

(I also stumbled upon this bug report http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4619777 , which may affect you if you try to add your own encodings to the trusted applet ...)


Do you know of any “Charset extension libraries” that already do this (and provide many non-standard encodings)?

, , JCharset, 8 .

( - ) , , JCharset, .

+4

:

, CharsetProvider java.nio.charset.spi.

...

+1

sunilkumar from vmoksha

Please check your .xml file containing UTF-8

0
source

All Articles