commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Tompkins (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (TEXT-118) JSON escaping incorrect for the delete control character
Date Fri, 28 Sep 2018 16:36:00 GMT

     [ https://issues.apache.org/jira/browse/TEXT-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rob Tompkins resolved TEXT-118.
-------------------------------
    Resolution: Fixed

Thanks https://github.com/nandorKollar

> JSON escaping incorrect for the delete control character
> --------------------------------------------------------
>
>                 Key: TEXT-118
>                 URL: https://issues.apache.org/jira/browse/TEXT-118
>             Project: Commons Text
>          Issue Type: Bug
>    Affects Versions: 1.2
>         Environment: JDK8u162, Mac OS X 13.something.
>            Reporter: Dan Wallach
>            Assignee: Rob Tompkins
>            Priority: Minor
>
> Here's a simple unit test. The assertion about backspace succeeds. The assertion about
the delete character fails. Instead, the delete character shows up in the escaped text. This
violates the JSON spec, which forbids "control characters" in strings.
> {code:java}
> @Test
> public void testDeleteCharacter() {
>   String backspaceString = "Backspace: \b";
>   String deleteString = "Delete: \u007F";
>   assertEquals("Backspace: \\b", StringEscapeUtils.escapeJson(backspaceString));
>   assertEquals("Delete: \\u007F", StringEscapeUtils.escapeJson(deleteString));
> }
> {code}
>  
> The JSON spec doesn't have a specific escape for a delete character, but it does explicitly
exclude control characters from passing through. I'd recommend behavior as in the above unit
test.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message