Class StandardEncodingTranslator
- java.lang.Object
-
- org.htmlunit.cyberneko.xerces.util.StandardEncodingTranslator
-
- All Implemented Interfaces:
EncodingTranslator
public final class StandardEncodingTranslator extends Object implements EncodingTranslator
EncodingTranslator based on https://encoding.spec.whatwg.org/#names-and-labels- Author:
- Ronald Brill, Lai Quang Duong, Atsushi Nakagawa
-
-
Field Summary
Fields Modifier and Type Field Description static Map<String,String>ENCODING_FROM_LABELEncoding names and labels Made public to let other also use this (like HtmlUnit TextDecoder).static Map<String,String>ENCODING_TO_IANA_ENCODINGDifferences from iana naming Made public to let other also use this (like HtmlUnit TextDecoder).static Map<String,String>IANA_TO_JAVA_ENCODINGSstatic StandardEncodingTranslatorINSTANCESingleton.static StringREPLACEMENThttps://encoding.spec.whatwg.org/#replacement
-
-
-
Field Detail
-
INSTANCE
public static final StandardEncodingTranslator INSTANCE
Singleton.
-
REPLACEMENT
public static final String REPLACEMENT
https://encoding.spec.whatwg.org/#replacementFor the moment we are using this constant in the
HTMLScannerto support this encoding. Another option might be to install a proper charset impl in the jvm (like https://github.com/lovasoa/replacement-charset-java) but this might introduce some behavior changes for the whole vm and therefore we handle it here.- See Also:
- Constant Field Values
-
ENCODING_FROM_LABEL
public static final Map<String,String> ENCODING_FROM_LABEL
Encoding names and labels Made public to let other also use this (like HtmlUnit TextDecoder).
-
ENCODING_TO_IANA_ENCODING
public static final Map<String,String> ENCODING_TO_IANA_ENCODING
Differences from iana naming Made public to let other also use this (like HtmlUnit TextDecoder).
-
-
Method Detail
-
encodingNameFromLabel
public String encodingNameFromLabel(String charsetLabel)
- Specified by:
encodingNameFromLabelin interfaceEncodingTranslator- Returns:
- the Java encoding name for the specified HTTP encoding name, or
nullif the name is unknown. The returned encoding name may or may not be supported by the running JVM. UseCharset.isSupported(String)to check availability. Moreover, either of the special definitionsREPLACEMENTor "x-user-defined" may be returned depending on input.
-
-