- changed title to XLIFF2 Lib: Fragment#toXLIFF does not escape a sequence "]]>"
XLIFF2 Lib: Fragment#toXLIFF does not escape a sequence "]]>"
Issue #1000
resolved
Original report, copied from https://bitbucket.org/okapiframework/xliff-toolkit/issues/36/fragment-toxliff-does-not-escape-a:
net.sf.okapi.lib.xliff2.core.Fragment has a method toXLIFF(). This code writes out content of fragment to XLFF stream. However, the implementation write out a sequence “]]>” without escaping. In this case, the output XLIFF becomes a malformed XML.
I tried Rainbow to create a translation kit with XLIFF2 for a test plain text file - with content:
This is a test ]]>
The XLIFF file produced for this input is below:
<?xml version="1.0"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en-US" trgLang="fr-FR" xmlns:its="http://www.w3.org/2005/11/its" xmlns:itsxlf="http://www.w3.org/ns/its-xliff/" its:version="2.0">
<file id="f1" original="/D:/tmp/text/test1.txt">
<unit id="1">
<segment>
<source xml:space="preserve">This is a test ]]></source>
</segment>
</unit>
</file>
</xliff>
XMLReader.validate() returns an error for this file - lineNumber: 6; columnNumber: 52; The character sequence "]]>" must not appear in content unless used to mark the end of a CDATA section.
Comments (3)
-
reporter -
- edited description
-
- changed status to resolved
- Log in to comment