You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "clover (Jira)" <ji...@apache.org> on 2022/11/09 06:49:00 UTC

[jira] [Created] (TEXT-222) StringEscapeUtils.escapeJava() cannot restore string processed by unescapeJava()

clover created TEXT-222:
---------------------------

             Summary: StringEscapeUtils.escapeJava() cannot restore string processed by unescapeJava()
                 Key: TEXT-222
                 URL: https://issues.apache.org/jira/browse/TEXT-222
             Project: Commons Text
          Issue Type: Bug
    Affects Versions: 1.6
            Reporter: clover


When we called StringEscapeUtils.unescapeJava(orignal) and then called StringEscapeUtils.escapeJava(unescaped), sometimes the orginal string cannot be rest as expected.
For example: 
    // Commons Text 1.6
    String unescapeJava = StringEscapeUtils.unescapeJava("wwww\\u202{color:#FF0000}e{color}uuuu");
    System.out.println("unescapeJava=" + unescapeJava);   // print unescapeJava=wwww‮uuuu
    System.out.println("escapeJava=" + StringEscapeUtils.escapeJava(unescapeJava)); // print escapeJava=wwww\u202{color:#FF0000}E{color}uuuu
The lowercase 'e' in "wwww\\u202euuuu" is converted to uppercase 'E'.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)