[ https://issues.apache.org/jira/browse/LANG-898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13800139#comment-13800139 ]
Benedikt Ritter commented on LANG-898: -------------------------------------- Resolve as not a problem? > StringEscapeUtils un/escapexml inconsistant with escaped whitespace > ------------------------------------------------------------------- > > Key: LANG-898 > URL: https://issues.apache.org/jira/browse/LANG-898 > Project: Commons Lang > Issue Type: Bug > Components: lang.* > Affects Versions: 3.1 > Environment: Windows 7, Java 7 > Reporter: Martin Barrs > Priority: Minor > Fix For: Discussion > > > {noformat} > In an escaped XML string with escaped whitespace, in this case linefeed ( > ), escapexml and unescapexml treat the linefeed inconsistently. > unescape converts to a linefeed, yet escapexml does not convert > linefeed back to > Here's code and output... > public static void main(String[] args) { > String escaped = > "<?xml version="1.0" > encoding="iso-8859-1"?> <?xml version="1.0" > encoding="iso-8859-1"?>"; > System.out.println(escaped); > System.out.println(); > System.out.println(StringEscapeUtils.unescapeXml(escaped)); > System.out.println(); > System.out.println(StringEscapeUtils.escapeXml(StringEscapeUtils > .unescapeXml(escaped))); > } > > Output: > <?xml version="1.0" > encoding="iso-8859-1"?> <?xml version="1.0" > encoding="iso-8859-1"?> > <?xml version="1.0" encoding="iso-8859-1"?> > <?xml version="1.0" encoding="iso-8859-1"?> > <?xml version="1.0" encoding="iso-8859-1"?> > <?xml version="1.0" encoding="iso-8859-1"?> > {noformat} -- This message was sent by Atlassian JIRA (v6.1#6144)