openplanets/jpylyzer — Issue #13: Avoiding control characters in XML output
Author: bitsgalore
Created: 2012-03-02 12:28:58+00:00
State: open

Under various circumstances (e.g. corrupted files) XML output may contain illegal control characters (e.g. null bytes). For properties that are directly converted from bytes to text there is already a mechanism that will suppress null characters, but they may stil occur in UTF-8 and Latin-encoded text.

This may affect output related to codestream comments (Latin), and URL boxes within UUID Info boxes (UTF-8).

XML boxes might be affected as well, although the built-in well formedness check in the XML box validator function will probably prevent any problems here.

Possible solutions:

1. Use containsControlCharacters directly in URL and Codestream validator functions (i.e. before decoding to UTF-8/Latin)

2. OR replace control characters with something else

While at it, containsControlCharacters should catch all characters in the 0-31 byte range (none of which are allowed in XML and none of which can be replaced with entity references)