Menu

#10 Assumes default encoding Latin1

open
nobody
None
5
2004-01-30
2004-01-30
Anonymous
No

MHPTester does not run on MHP conform implementations

MHP 1.0.2 and MHP1.0.3 define in 11.2.11:
"Where the specification of the Java APIs refers to the
default character encoding of the platform, the default
for MHP shall be "UTF8" as defined in 7.1.5, "Monomedia
format for text" on page 52. The encoding "latin1" shall
also be supported as defined in ISO 8859-1 [20]."

However, on MHP implementations with default character
encoding UTF8, MHPTester does not start, but throws
the following exception:

sun.io.MalformedInputException
at sun.io.ByteToCharUTF8.convert()
at java.io.InputStreamReader.convertInto()
at java.io.InputStreamReader.fill()
at java.io.InputStreamReader.read()
at java.io.InputStreamReader.read()
at nanoxml.XMLElement.readChar()
at nanoxml.XMLElement.scanPCData()
at nanoxml.XMLElement.scanElement()
at nanoxml.XMLElement.scanElement()
at nanoxml.XMLElement.scanElement()
at nanoxml.XMLElement.parseFromReader()
at nanoxml.XMLElement.parseFromReader()
at com.mindonmove.mhptester.Util.getParsedXML()
at
com.mindonmove.mhptester.Config.parseAppConfiguration
()
at com.mindonmove.mhptester.Config.<init>()
at com.mindonmove.mhptester.Controller.start()
at com.mindonmove.mhptester.Controller.start()
at
com.mindonmove.mhptester.MHPTesterXlet.startXlet()

Proposed solution: make sure all input files are encoded
in UTF8 format.
Alternatively, explicitly set text encoding to Latin1 for
InputStreamReaders, Strings, etc.
However, in the latter case, I strongly advice to add an
explicit test to check the default character enconding.

Discussion


Log in to post a comment.