Package org.htmlunit.cyberneko
Class HTMLScanner
java.lang.Object
org.htmlunit.cyberneko.HTMLScanner
- All Implemented Interfaces:
HTMLComponent,XMLComponent,XMLDocumentSource,XMLLocator,Locator2,Locator
A simple HTML scanner. This scanner makes no attempt to balance tags or fix
other problems in the source document — it just scans what it can and
generates XNI document "events", ignoring errors of all kinds.
This component recognizes the following features:
- http://cyberneko.org/html/features/augmentations
- http://cyberneko.org/html/features/report-errors
- http://cyberneko.org/html/features/scanner/script/strip-cdata-delims
- http://cyberneko.org/html/features/scanner/script/strip-comment-delims
- http://cyberneko.org/html/features/scanner/style/strip-cdata-delims
- http://cyberneko.org/html/features/scanner/style/strip-comment-delims
- http://cyberneko.org/html/features/scanner/ignore-specified-charset
- http://cyberneko.org/html/features/scanner/cdata-sections
- http://cyberneko.org/html/features/scanner/cdata-early-closing
- http://cyberneko.org/html/features/override-doctype
- http://cyberneko.org/html/features/insert-doctype
- http://cyberneko.org/html/features/parse-noscript-content
- http://cyberneko.org/html/features/scanner/allow-selfclosing-iframe
- http://cyberneko.org/html/features/scanner/allow-selfclosing-tags
- http://cyberneko.org/html/features/scanner/normalize-attrs
- http://cyberneko.org/html/features/scanner/plain-attr-values
This component recognizes the following properties:
- http://cyberneko.org/html/properties/names/elems
- http://cyberneko.org/html/properties/names/attrs
- http://cyberneko.org/html/properties/default-encoding
- http://cyberneko.org/html/properties/error-reporter
- http://cyberneko.org/html/properties/encoding-translator
- http://cyberneko.org/html/properties/doctype/pubid
- http://cyberneko.org/html/properties/doctype/sysid
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThe primary HTML document scanner.(package private) static final classCurrent entity.classSpecial scanner used forPLAINTEXT.static interfaceBasic scanner interface.private static enumclassSpecial scanner used forscript's.classSpecial scanner used for elements whose content needs to be scanned as plain text, ignoring markup such as elements and entity references. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAllows self closing <iframe/> tag.static final StringAllows self closing <script/> tag.static final StringAllows self closing tags e.g.static final StringInclude infoset augmentations.static final String'>' closes the cdata section (see html spec).static final StringWhether CDATA sections (<![CDATA[...]]>) are treated as proper XML CDATA sections or as HTML comments.private static final booleanSet to true to debug the buffer.protected static final booleanSet to true to debug callbacks.private static final booleanSet to true to debug character encoding handling.private static final booleanSet to true to debug changes in the scanner.private static final booleanSet to true to debug changes in the scanner state.static final StringDefault encoding.static final StringDoctype declaration public identifier.static final StringDoctype declaration system identifier.static final StringEncoding translator.static final StringError reporter.(package private) booleanAllows self closing iframe tags.(package private) booleanAllows self closing script tags.(package private) booleanAllows self closing tags.private booleanAugmentations.protected intBeginning character offset in the file.protected intBeginning column number.protected intBeginning line number.protected PlaybackInputStreamThe playback byte stream.(package private) booleanCDATA early closing.(package private) booleanCDATA sections.protected HTMLScanner.ScannerContent scanner.protected HTMLScanner.CurrentEntityCurrent entity.protected final MiniStack<HTMLScanner.CurrentEntity>The current entity stack.protected StringDefault encoding.protected StringDoctype declaration public identifier.protected StringDoctype declaration system identifier.protected XMLDocumentHandlerThe document handler.protected intElement count.protected intElement depth.protected EncodingTranslatorError reporter.protected HTMLErrorReporterError reporter.private Stringif not empty this is the name of the tag, that requires the special scanner.protected StringAuto-detected IANA encoding.(package private) booleanIgnore specified character set.(package private) booleanInsert document type declaration.protected StringAuto-detected Java encoding.private final LocationItemOur location item, to be reused becauseAugmentationssays so, so let's save on memoryprotected shortModify HTML attribute names.protected shortModify HTML element names.(package private) booleanNormalize attribute values.private booleanOverride doctype declaration public and system identifiers.(package private) booleanParse noscript content.(package private) booleanStore the plain attribute values also.private int(package private) booleanReport errors.(package private) final XMLStringprivate final XMLStringprotected HTMLScanner.ScannerThe current scanner.protected shortThe current scanner state.(package private) final XMLStringprotected final HTMLScanner.ScriptScannerSpecial scanner used script tags.(package private) booleanStrip CDATA delimiters from SCRIPT tags.(package private) booleanStrip comment delimiters from SCRIPT tags.(package private) final boolean[]Reusable single-element boolean array used as an out-parameter.protected final HTMLScanner.SpecialScannerSpecial scanner used for elements whose content needs to be scanned as plain text, ignoring markup such as elements and entity references.protected final XMLStringString buffer.(package private) final XMLStringString buffer used when resolving entity refs.(package private) final XMLString(package private) booleanStrip CDATA delimiters from STYLE tags.(package private) booleanStrip comment delimiters from STYLE tags.static final StringHTML 4.01 frameset public identifier ("-//W3C//DTD HTML 4.01 Frameset//EN").static final StringHTML 4.01 frameset system identifier ("http://www.w3.org/TR/html4/frameset.dtd").static final StringHTML 4.01 strict public identifier ("-//W3C//DTD HTML 4.01//EN").static final StringHTML 4.01 strict system identifier ("http://www.w3.org/TR/html4/strict.dtd").static final StringHTML 4.01 transitional public identifier ("-//W3C//DTD HTML 4.01 Transitional//EN").static final StringHTML 4.01 transitional system identifier ("http://www.w3.org/TR/html4/loose.dtd").(package private) final HTMLConfigurationstatic final StringIgnore specified charset found in the <meta equiv='Content-Type' content='text/html;charset='…'> tag or in the <?xml … encoding='…'> processing instruction.static final StringInsert document type declaration.static final StringModify HTML attribute names: { "upper", "lower", "default" }.static final StringModify HTML element names: { "upper", "lower", "default" }.protected static final shortLowercase HTML names.protected static final shortDon't modify HTML names.protected static final shortUppercase HTML names.static final StringNormalize attribute values.static final StringOverride doctype declaration public and system identifiers.static final StringParse <noscript>...</noscript> content.static final StringStore the plain attribute values also.static final StringReader buffer size.private static final String[]Recognized features.private static final Boolean[]Recognized features defaults.private static final String[]Recognized properties.private static final Object[]Recognized properties defaults.static final StringReport errors.private static final intScan return code: end of entity reached (EOF).private static final intScan return code: continue scanning (state transition).private static final intScan return code: operation completed normally.static final StringStrip XHTML CDATA delimiters ("<![CDATA[" and "]]>") from SCRIPT tag contents.static final StringStrip HTML comment delimiters ("<!−−" and "−−>") from SCRIPT tag contents.protected static final shortState: content.protected static final shortState: end document.protected static final shortState: markup bracket.protected static final shortState: start document.static final StringStrip XHTML CDATA delimiters ("<![CDATA[" and "]]>") from STYLE tag contents.static final StringStrip HTML comment delimiters ("<!−−" and "−−>") from STYLE tag contents. -
Constructor Summary
ConstructorsConstructorDescriptionHTMLScanner(HTMLConfiguration htmlConfiguration) Creates a new HTMLScanner with the given configuration -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleancanRoundtrip(String encodeCharset, String decodeCharset) voidcleanup(boolean closeall) Cleans up used resources.voidevaluateInputSource(XMLInputSource inputSource) Immediately evaluates an input source and add the new content (e.g.protected static StringFixes a platform dependent filename to standard URI form.Returns the base system identifier.intReturns the character offset.intReturns the current column number.Returns the encoding.getFeatureDefault(String featureId) Returns the default state for a feature.intReturns the current line number.Returns the literal system identifier.protected static shortgetNamesValue(String value) getPropertyDefault(String propertyId) Returns the default state for a property.Returns the public identifier.private ReadergetReader(XMLInputSource inputSource) String[]Returns recognized features.String[]Returns recognized properties.Returns the expanded system identifier.protected static StringgetValue(XMLAttributes attrs, String aname) Returns the XML version.(package private) static booleanisEncodingCompatible(String encoding1, String encoding2) To detect if 2 encoding are compatible, both must be able to read the meta tag specifying the new encoding.protected final AugmentationslocationAugs(HTMLScanner.CurrentEntity currentEntity) voidpushInputSource(XMLInputSource inputSource) Pushes an input source onto the current entity stack.voidreset(XMLComponentManager manager) Resets the component.private intreturnEntityRefString(XMLString str, boolean content) protected intbooleanscanDocument(boolean complete) Scans a document.protected intscanEntityRef(XMLString str, XMLString plainValue, boolean content) protected intprotected StringscanName(boolean strict, short mode) protected StringvoidsetDocumentHandler(XMLDocumentHandler handler) Sets the document handler.voidsetFeature(String featureId, boolean state) Sets a feature.voidsetInputSource(XMLInputSource source) Sets the input source.voidsetProperty(String propertyId, Object value) Sets a property.protected voidsetScanner(HTMLScanner.Scanner scanner) protected voidsetScannerState(short state) protected final Augmentationsstatic StringExpands a system id and returns the system id as a URI, if it can be expanded.
-
Field Details
-
HTML_4_01_STRICT_PUBID
HTML 4.01 strict public identifier ("-//W3C//DTD HTML 4.01//EN").- See Also:
-
HTML_4_01_STRICT_SYSID
HTML 4.01 strict system identifier ("http://www.w3.org/TR/html4/strict.dtd").- See Also:
-
HTML_4_01_TRANSITIONAL_PUBID
HTML 4.01 transitional public identifier ("-//W3C//DTD HTML 4.01 Transitional//EN").- See Also:
-
HTML_4_01_TRANSITIONAL_SYSID
HTML 4.01 transitional system identifier ("http://www.w3.org/TR/html4/loose.dtd").- See Also:
-
HTML_4_01_FRAMESET_PUBID
HTML 4.01 frameset public identifier ("-//W3C//DTD HTML 4.01 Frameset//EN").- See Also:
-
HTML_4_01_FRAMESET_SYSID
HTML 4.01 frameset system identifier ("http://www.w3.org/TR/html4/frameset.dtd").- See Also:
-
AUGMENTATIONS
Include infoset augmentations.- See Also:
-
REPORT_ERRORS
Report errors.- See Also:
-
SCRIPT_STRIP_COMMENT_DELIMS
Strip HTML comment delimiters ("<!−−" and "−−>") from SCRIPT tag contents.- See Also:
-
SCRIPT_STRIP_CDATA_DELIMS
Strip XHTML CDATA delimiters ("<![CDATA[" and "]]>") from SCRIPT tag contents.- See Also:
-
STYLE_STRIP_COMMENT_DELIMS
Strip HTML comment delimiters ("<!−−" and "−−>") from STYLE tag contents.- See Also:
-
STYLE_STRIP_CDATA_DELIMS
Strip XHTML CDATA delimiters ("<![CDATA[" and "]]>") from STYLE tag contents.- See Also:
-
IGNORE_SPECIFIED_CHARSET
Ignore specified charset found in the <meta equiv='Content-Type' content='text/html;charset='…'> tag or in the <?xml … encoding='…'> processing instruction.- See Also:
-
CDATA_SECTIONS
Whether CDATA sections (<![CDATA[...]]>) are treated as proper XML CDATA sections or as HTML comments.- See Also:
-
CDATA_EARLY_CLOSING
'>' closes the cdata section (see html spec).- See Also:
-
OVERRIDE_DOCTYPE
Override doctype declaration public and system identifiers.- See Also:
-
INSERT_DOCTYPE
Insert document type declaration.- See Also:
-
PARSE_NOSCRIPT_CONTENT
Parse <noscript>...</noscript> content.- See Also:
-
ALLOW_SELFCLOSING_IFRAME
Allows self closing <iframe/> tag.- See Also:
-
ALLOW_SELFCLOSING_SCRIPT
Allows self closing <script/> tag.- See Also:
-
ALLOW_SELFCLOSING_TAGS
Allows self closing tags e.g. <div/> (XHTML)- See Also:
-
NORMALIZE_ATTRIBUTES
Normalize attribute values.- See Also:
-
PLAIN_ATTRIBUTE_VALUES
Store the plain attribute values also.- See Also:
-
RECOGNIZED_FEATURES
Recognized features. -
RECOGNIZED_FEATURES_DEFAULTS
Recognized features defaults. -
NAMES_ELEMS
Modify HTML element names: { "upper", "lower", "default" }.- See Also:
-
NAMES_ATTRS
Modify HTML attribute names: { "upper", "lower", "default" }.- See Also:
-
DEFAULT_ENCODING
Default encoding.- See Also:
-
ERROR_REPORTER
Error reporter.- See Also:
-
ENCODING_TRANSLATOR
Encoding translator.- See Also:
-
DOCTYPE_PUBID
Doctype declaration public identifier.- See Also:
-
DOCTYPE_SYSID
Doctype declaration system identifier.- See Also:
-
READER_BUFFER_SIZE
Reader buffer size.- See Also:
-
RECOGNIZED_PROPERTIES
Recognized properties. -
RECOGNIZED_PROPERTIES_DEFAULTS
Recognized properties defaults. -
STATE_CONTENT
protected static final short STATE_CONTENTState: content.- See Also:
-
STATE_MARKUP_BRACKET
protected static final short STATE_MARKUP_BRACKETState: markup bracket.- See Also:
-
STATE_START_DOCUMENT
protected static final short STATE_START_DOCUMENTState: start document.- See Also:
-
STATE_END_DOCUMENT
protected static final short STATE_END_DOCUMENTState: end document.- See Also:
-
NAMES_NO_CHANGE
protected static final short NAMES_NO_CHANGEDon't modify HTML names.- See Also:
-
NAMES_UPPERCASE
protected static final short NAMES_UPPERCASEUppercase HTML names.- See Also:
-
NAMES_LOWERCASE
protected static final short NAMES_LOWERCASELowercase HTML names.- See Also:
-
SCAN_TRUE
private static final int SCAN_TRUEScan return code: operation completed normally.- See Also:
-
SCAN_EOF
private static final int SCAN_EOFScan return code: end of entity reached (EOF).- See Also:
-
SCAN_FALSE
private static final int SCAN_FALSEScan return code: continue scanning (state transition).- See Also:
-
DEBUG_SCANNER
private static final boolean DEBUG_SCANNERSet to true to debug changes in the scanner.- See Also:
-
DEBUG_SCANNER_STATE
private static final boolean DEBUG_SCANNER_STATESet to true to debug changes in the scanner state.- See Also:
-
DEBUG_BUFFER
private static final boolean DEBUG_BUFFERSet to true to debug the buffer.- See Also:
-
DEBUG_CHARSET
private static final boolean DEBUG_CHARSETSet to true to debug character encoding handling.- See Also:
-
DEBUG_CALLBACKS
protected static final boolean DEBUG_CALLBACKSSet to true to debug callbacks.- See Also:
-
fAugmentations_
private boolean fAugmentations_Augmentations. -
fReportErrors_
boolean fReportErrors_Report errors. -
fScriptStripCDATADelims_
boolean fScriptStripCDATADelims_Strip CDATA delimiters from SCRIPT tags. -
fScriptStripCommentDelims_
boolean fScriptStripCommentDelims_Strip comment delimiters from SCRIPT tags. -
fStyleStripCDATADelims_
boolean fStyleStripCDATADelims_Strip CDATA delimiters from STYLE tags. -
fStyleStripCommentDelims_
boolean fStyleStripCommentDelims_Strip comment delimiters from STYLE tags. -
fIgnoreSpecifiedCharset_
boolean fIgnoreSpecifiedCharset_Ignore specified character set. -
fCDATASections_
boolean fCDATASections_CDATA sections. -
fCDATAEarlyClosing_
boolean fCDATAEarlyClosing_CDATA early closing. -
fOverrideDoctype_
private boolean fOverrideDoctype_Override doctype declaration public and system identifiers. -
fInsertDoctype_
boolean fInsertDoctype_Insert document type declaration. -
fNormalizeAttributes_
boolean fNormalizeAttributes_Normalize attribute values. -
fPlainAttributeValues_
boolean fPlainAttributeValues_Store the plain attribute values also. -
fParseNoScriptContent_
boolean fParseNoScriptContent_Parse noscript content. -
fAllowSelfclosingIframe_
boolean fAllowSelfclosingIframe_Allows self closing iframe tags. -
fAllowSelfclosingScript_
boolean fAllowSelfclosingScript_Allows self closing script tags. -
fAllowSelfclosingTags_
boolean fAllowSelfclosingTags_Allows self closing tags. -
fNamesElems
protected short fNamesElemsModify HTML element names. -
fNamesAttrs
protected short fNamesAttrsModify HTML attribute names. -
fDefaultIANAEncoding
Default encoding. -
fErrorReporter
Error reporter. -
fEncodingTranslator
Error reporter. -
fDoctypePubid
Doctype declaration public identifier. -
fDoctypeSysid
Doctype declaration system identifier. -
fReaderBufferSize
private int fReaderBufferSize -
fBeginLineNumber
protected int fBeginLineNumberBeginning line number. -
fBeginColumnNumber
protected int fBeginColumnNumberBeginning column number. -
fBeginCharacterOffset
protected int fBeginCharacterOffsetBeginning character offset in the file. -
fByteStream
The playback byte stream. -
fCurrentEntity
Current entity. -
fCurrentEntityStack
The current entity stack. -
fScanner
The current scanner. -
fScannerState
protected short fScannerStateThe current scanner state. -
fDocumentHandler
The document handler. -
fIANAEncoding
Auto-detected IANA encoding. -
fJavaEncoding
Auto-detected Java encoding. -
fElementCount
protected int fElementCountElement count. -
fElementDepth
protected int fElementDepthElement depth. -
fFragmentSpecialScannerTag_
if not empty this is the name of the tag, that requires the special scanner. -
fContentScanner
Content scanner. -
fSpecialScanner
Special scanner used for elements whose content needs to be scanned as plain text, ignoring markup such as elements and entity references. For example: <SCRIPT> and <COMMENT>. -
fScriptScanner
Special scanner used script tags. -
fStringBuffer
String buffer. -
fStringBufferEntityRef
String buffer used when resolving entity refs. -
fStringBufferPlainAttribValue
-
fScanUntilEndTag
-
fScanComment
-
fScanLiteral
-
fSingleBoolean
final boolean[] fSingleBooleanReusable single-element boolean array used as an out-parameter.Performance optimization: This array is reused across method calls to avoid allocating a new single-element array on every invocation of methods like
scanStartElementandscanAttribute. The array is reset before each use to ensure correctness.Thread safety: Safe because scanner instances are single-threaded.
-
htmlConfiguration_
-
fLocationItem
Our location item, to be reused becauseAugmentationssays so, so let's save on memory
-
-
Constructor Details
-
HTMLScanner
HTMLScanner(HTMLConfiguration htmlConfiguration) Creates a new HTMLScanner with the given configuration- Parameters:
htmlConfiguration- the configuration to use
-
-
Method Details
-
pushInputSource
Pushes an input source onto the current entity stack. This enables the scanner to transparently scan new content (e.g. the output written by an embedded script). At the end of the current entity, the scanner returns where it left off at the time this entity source was pushed.Note: This functionality is experimental at this time and is subject to change in future releases of NekoHTML.
- Parameters:
inputSource- The new input source to start scanning.- See Also:
-
getReader
-
evaluateInputSource
Immediately evaluates an input source and add the new content (e.g. the output written by an embedded script).- Parameters:
inputSource- The new input source to start evaluating.- See Also:
-
cleanup
public void cleanup(boolean closeall) Cleans up used resources. For example, if scanning is terminated early, then this method ensures all remaining open streams are closed.- Parameters:
closeall- Close all streams, including the original. This is used in cases when the application has opened the original document stream and should be responsible for closing it.
-
getEncoding
Returns the encoding.- Specified by:
getEncodingin interfaceLocator2
-
getPublicId
Returns the public identifier.- Specified by:
getPublicIdin interfaceLocator
-
getBaseSystemId
Returns the base system identifier.- Specified by:
getBaseSystemIdin interfaceXMLLocator- Returns:
- the base system identifier.
-
getLiteralSystemId
Returns the literal system identifier.- Specified by:
getLiteralSystemIdin interfaceXMLLocator- Returns:
- the literal system identifier.
-
getSystemId
Returns the expanded system identifier.- Specified by:
getSystemIdin interfaceLocator
-
getLineNumber
public int getLineNumber()Returns the current line number.- Specified by:
getLineNumberin interfaceLocator
-
getColumnNumber
public int getColumnNumber()Returns the current column number.- Specified by:
getColumnNumberin interfaceLocator
-
getXMLVersion
Returns the XML version.- Specified by:
getXMLVersionin interfaceLocator2
-
getCharacterOffset
public int getCharacterOffset()Returns the character offset.- Specified by:
getCharacterOffsetin interfaceXMLLocator- Returns:
- the character offset, or
-1if no character offset is available.
-
getFeatureDefault
Returns the default state for a feature.- Specified by:
getFeatureDefaultin interfaceHTMLComponent- Specified by:
getFeatureDefaultin interfaceXMLComponent- Parameters:
featureId- The feature identifier.- Returns:
- the default state for a feature, or null if this component does not want to report a default value for this feature.
-
getPropertyDefault
Returns the default state for a property.- Specified by:
getPropertyDefaultin interfaceHTMLComponent- Specified by:
getPropertyDefaultin interfaceXMLComponent- Parameters:
propertyId- The property identifier.- Returns:
- the default state for a property, or null if this component does not want to report a default value for this property
-
getRecognizedFeatures
Returns recognized features.- Specified by:
getRecognizedFeaturesin interfaceXMLComponent- Returns:
- an array of feature identifiers that are recognized by this component. This method may return null if no features are recognized by this component.
-
getRecognizedProperties
Returns recognized properties.- Specified by:
getRecognizedPropertiesin interfaceXMLComponent- Returns:
- an array of property identifiers that are recognized by this component. This method may return null if no properties are recognized by this component.
-
reset
Resets the component.- Specified by:
resetin interfaceXMLComponent- Parameters:
manager- The component manager.- Throws:
XMLConfigurationException
-
setFeature
Sets a feature.- Specified by:
setFeaturein interfaceXMLComponent- Parameters:
featureId- The feature identifier.state- The state of the feature.
-
setProperty
Sets a property.- Specified by:
setPropertyin interfaceXMLComponent- Parameters:
propertyId- The property identifier.value- The value of the property.- Throws:
XMLConfigurationException- Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.
-
setInputSource
Sets the input source.- Parameters:
source- The input source.- Throws:
IOException- Thrown on i/o error.
-
scanDocument
Scans a document.- Parameters:
complete- True if the scanner should scan the document completely, pushing all events to the registered document handler. A value of false indicates that the scanner should only scan the next portion of the document and return. A scanner instance is permitted to completely scan a document if it does not support this "pull" scanning model.- Returns:
- True if there is more to scan, false otherwise.
- Throws:
IOException- Thrown on i/o error.XNIException- on error.
-
setDocumentHandler
Sets the document handler.- Specified by:
setDocumentHandlerin interfaceXMLDocumentSource- Parameters:
handler- the new handler
-
getDocumentHandler
- Specified by:
getDocumentHandlerin interfaceXMLDocumentSource- Returns:
- the document handler
-
getValue
-
systemId
Expands a system id and returns the system id as a URI, if it can be expanded. A return value of null means that the identifier is already expanded. An exception thrown indicates a failure to expand the id.- Parameters:
systemId- The systemId to be expanded.baseSystemId- baseSystemId- Returns:
- Returns the URI string representing the expanded system identifier. A null value indicates that the given system identifier is already expanded.
-
fixURI
Fixes a platform dependent filename to standard URI form.- Parameters:
str- The string to fix.- Returns:
- Returns the fixed URI string.
-
getNamesValue
-
setScanner
-
setScannerState
protected void setScannerState(short state) -
scanDoctype
- Throws:
IOException
-
scanLiteral
- Throws:
IOException
-
scanName
- Throws:
IOException
-
scanTagName
- Throws:
IOException
-
scanEntityRef
protected int scanEntityRef(XMLString str, XMLString plainValue, boolean content) throws IOException - Throws:
IOException
-
returnEntityRefString
-
locationAugs
-
synthesizedAugs
-
isEncodingCompatible
To detect if 2 encoding are compatible, both must be able to read the meta tag specifying the new encoding. This means that the byte representation of some minimal html markup must be the same in both encodings -
canRoundtrip
private static boolean canRoundtrip(String encodeCharset, String decodeCharset) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-