You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "polygenelubricants (JIRA)" <ji...@apache.org> on 2010/08/22 19:46:18 UTC

[jira] Created: (LANG-646) StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u

StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u
------------------------------------------------------------------------------------

                 Key: LANG-646
                 URL: https://issues.apache.org/jira/browse/LANG-646
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.*
    Affects Versions: 2.5
         Environment: Irrelevant
            Reporter: polygenelubricants
            Priority: Minor


CODE TO REPRODUCE BUG:

System.out.println("\45".equals(StringEscapeUtils.unescapeJava("\\45")));
// false

System.out.println(StringEscapeUtils.unescapeJava("\\uu0030"));
// throws NestableRuntimeException:

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LANG-646) StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u

Posted by "polygenelubricants (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

polygenelubricants updated LANG-646:
------------------------------------

    Description: 
CODE TO REPRODUCE BUG:

System.out.println(
"\45".equals(StringEscapeUtils.unescapeJava("\\45"))
); // false

System.out.println(
StringEscapeUtils.unescapeJava("\\uu0030")
); // throws NestableRuntimeException:

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

  was:
CODE TO REPRODUCE BUG:

System.out.println("\45".equals(StringEscapeUtils.unescapeJava("\\45")));
// false

System.out.println(StringEscapeUtils.unescapeJava("\\uu0030"));
// throws NestableRuntimeException:

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3


> StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-646
>                 URL: https://issues.apache.org/jira/browse/LANG-646
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5
>         Environment: Irrelevant
>            Reporter: polygenelubricants
>            Priority: Minor
>
> CODE TO REPRODUCE BUG:
> System.out.println(
> "\45".equals(StringEscapeUtils.unescapeJava("\\45"))
> ); // false
> System.out.println(
> StringEscapeUtils.unescapeJava("\\uu0030")
> ); // throws NestableRuntimeException:
> This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.
> REFERENCES:
> 3.10.6 Escape Sequences for Character and String Literals
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6
> 3.3 Unicode Escapes
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-646) StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u

Posted by "polygenelubricants (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907178#action_12907178 ] 

polygenelubricants commented on LANG-646:
-----------------------------------------

By the way Henri, the double backslashes in your comment are rendered as newlines somehow. I also had the same problem with the original bug report before I figured out how to quote codes. This is a bug in the bug tracking system rendered, it seems.

Let's reproduce this again \\ there you go.

> StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-646
>                 URL: https://issues.apache.org/jira/browse/LANG-646
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5
>         Environment: Irrelevant
>            Reporter: polygenelubricants
>            Priority: Minor
>
> CODE TO REPRODUCE BUG:
> {noformat}
> System.out.println("\45");
> // %
> System.out.println(StringEscapeUtils.unescapeJava("\\45"));
> // 45, should be %
> System.out.println("\uu0030");
> // 0
> System.out.println(StringEscapeUtils.unescapeJava("\\uu0030"));
> // throws NestableRuntimeException:
> {noformat}
> This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.
> REFERENCES:
> 3.10.6 Escape Sequences for Character and String Literals
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6
> 3.3 Unicode Escapes
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3
> EXTERNAL LINKS:
> http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LANG-646) StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u

Posted by "polygenelubricants (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

polygenelubricants updated LANG-646:
------------------------------------

    Description: 
CODE TO REPRODUCE BUG:

{noformat}
System.out.println("\45");
// %
System.out.println(StringEscapeUtils.unescapeJava("\\45"));
// 45, should be %

System.out.println("\uu0030");
// 0
System.out.println(StringEscapeUtils.unescapeJava("\\uu0030"));
// throws NestableRuntimeException:
{noformat}

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

EXTERNAL LINKS:

http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

  was:
CODE TO REPRODUCE BUG:

{noformat}
System.out.println("\45");
// %
System.out.println(StringEscapeUtils.unescapeJava("\\45"));
// 45, should be %

StringEscapeUtils.unescapeJava("\\uu0030"));
// throws NestableRuntimeException:
{noformat}

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

EXTERNAL LINKS:

http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/


> StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-646
>                 URL: https://issues.apache.org/jira/browse/LANG-646
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5
>         Environment: Irrelevant
>            Reporter: polygenelubricants
>            Priority: Minor
>
> CODE TO REPRODUCE BUG:
> {noformat}
> System.out.println("\45");
> // %
> System.out.println(StringEscapeUtils.unescapeJava("\\45"));
> // 45, should be %
> System.out.println("\uu0030");
> // 0
> System.out.println(StringEscapeUtils.unescapeJava("\\uu0030"));
> // throws NestableRuntimeException:
> {noformat}
> This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.
> REFERENCES:
> 3.10.6 Escape Sequences for Character and String Literals
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6
> 3.3 Unicode Escapes
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3
> EXTERNAL LINKS:
> http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LANG-646) StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u

Posted by "polygenelubricants (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

polygenelubricants updated LANG-646:
------------------------------------

    Description: 
(Note: there seems to be a bug in the issue tracker where a double backslash is rendered as newline separator instead.)

CODE TO REPRODUCE BUG:

System.out.println(
"\45".equals(StringEscapeUtils.unescapeJava("\\45"))
); // false

System.out.println(
StringEscapeUtils.unescapeJava("\\uu0030")
); // throws NestableRuntimeException:

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

EXTERNAL LINKS:

http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

  was:
CODE TO REPRODUCE BUG:

System.out.println(
"\45".equals(StringEscapeUtils.unescapeJava("\\45"))
); // false

System.out.println(
StringEscapeUtils.unescapeJava("\\uu0030")
); // throws NestableRuntimeException:

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3


> StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-646
>                 URL: https://issues.apache.org/jira/browse/LANG-646
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5
>         Environment: Irrelevant
>            Reporter: polygenelubricants
>            Priority: Minor
>
> (Note: there seems to be a bug in the issue tracker where a double backslash is rendered as newline separator instead.)
> CODE TO REPRODUCE BUG:
> System.out.println(
> "\45".equals(StringEscapeUtils.unescapeJava("\\45"))
> ); // false
> System.out.println(
> StringEscapeUtils.unescapeJava("\\uu0030")
> ); // throws NestableRuntimeException:
> This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.
> REFERENCES:
> 3.10.6 Escape Sequences for Character and String Literals
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6
> 3.3 Unicode Escapes
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3
> EXTERNAL LINKS:
> http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-646) StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12902608#action_12902608 ] 

Henri Yandell commented on LANG-646:
------------------------------------

The 'uu' version isn't a problem in the current 3.0 codebase, that was added as a part of creating a UnicodeUnescaper.

The octal escape isn't handled though and needs to be added as a new Unescaper/Escaper pair in text translate.

> StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-646
>                 URL: https://issues.apache.org/jira/browse/LANG-646
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5
>         Environment: Irrelevant
>            Reporter: polygenelubricants
>            Priority: Minor
>
> CODE TO REPRODUCE BUG:
> {noformat}
> System.out.println("\45");
> // %
> System.out.println(StringEscapeUtils.unescapeJava("\\45"));
> // 45, should be %
> System.out.println("\uu0030");
> // 0
> System.out.println(StringEscapeUtils.unescapeJava("\\uu0030"));
> // throws NestableRuntimeException:
> {noformat}
> This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.
> REFERENCES:
> 3.10.6 Escape Sequences for Character and String Literals
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6
> 3.3 Unicode Escapes
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3
> EXTERNAL LINKS:
> http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-646) StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907110#action_12907110 ] 

Henri Yandell commented on LANG-646:
------------------------------------

Escaper is easy to write; unescaper is a bit of a pain. Ideally the generic unescaper would know how to escape '\\510' happily, but Java adds the constraints of a max of 377, leading to that being inferred as '\\51' + '0'. Thus the unescaper needs to have a configurable range, and as it plucks numbers off the text it needs to check if has gone beyond the maximum size.


> StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-646
>                 URL: https://issues.apache.org/jira/browse/LANG-646
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5
>         Environment: Irrelevant
>            Reporter: polygenelubricants
>            Priority: Minor
>
> CODE TO REPRODUCE BUG:
> {noformat}
> System.out.println("\45");
> // %
> System.out.println(StringEscapeUtils.unescapeJava("\\45"));
> // 45, should be %
> System.out.println("\uu0030");
> // 0
> System.out.println(StringEscapeUtils.unescapeJava("\\uu0030"));
> // throws NestableRuntimeException:
> {noformat}
> This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.
> REFERENCES:
> 3.10.6 Escape Sequences for Character and String Literals
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6
> 3.3 Unicode Escapes
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3
> EXTERNAL LINKS:
> http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LANG-646) StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u

Posted by "polygenelubricants (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

polygenelubricants updated LANG-646:
------------------------------------

    Description: 
(Note: there seems to be a bug in the issue tracker where a double backslash is rendered as newline separator instead.)

CODE TO REPRODUCE BUG:

{noformat}
System.out.println(
"\45".equals(StringEscapeUtils.unescapeJava("\\45"))
); // false

System.out.println(
StringEscapeUtils.unescapeJava("\\uu0030")
); // throws NestableRuntimeException:
{noformat}

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

EXTERNAL LINKS:

http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

  was:
(Note: there seems to be a bug in the issue tracker where a double backslash is rendered as newline separator instead.)

CODE TO REPRODUCE BUG:

System.out.println(
"\45".equals(StringEscapeUtils.unescapeJava("\\45"))
); // false

System.out.println(
StringEscapeUtils.unescapeJava("\\uu0030")
); // throws NestableRuntimeException:

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

EXTERNAL LINKS:

http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/


> StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-646
>                 URL: https://issues.apache.org/jira/browse/LANG-646
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5
>         Environment: Irrelevant
>            Reporter: polygenelubricants
>            Priority: Minor
>
> (Note: there seems to be a bug in the issue tracker where a double backslash is rendered as newline separator instead.)
> CODE TO REPRODUCE BUG:
> {noformat}
> System.out.println(
> "\45".equals(StringEscapeUtils.unescapeJava("\\45"))
> ); // false
> System.out.println(
> StringEscapeUtils.unescapeJava("\\uu0030")
> ); // throws NestableRuntimeException:
> {noformat}
> This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.
> REFERENCES:
> 3.10.6 Escape Sequences for Character and String Literals
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6
> 3.3 Unicode Escapes
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3
> EXTERNAL LINKS:
> http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LANG-646) StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u

Posted by "polygenelubricants (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

polygenelubricants updated LANG-646:
------------------------------------

    Description: 
CODE TO REPRODUCE BUG:

{noformat}
System.out.println("\45");
// %
System.out.println(StringEscapeUtils.unescapeJava("\\45"));
// 45, should be %

StringEscapeUtils.unescapeJava("\\uu0030"));
// throws NestableRuntimeException:
{noformat}

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

EXTERNAL LINKS:

http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

  was:
CODE TO REPRODUCE BUG:

{noformat}
System.out.println(
    "\45".equals(StringEscapeUtils.unescapeJava("\\45"))
); // false

System.out.println(
    StringEscapeUtils.unescapeJava("\\uu0030")
); // throws NestableRuntimeException:
{noformat}

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

EXTERNAL LINKS:

http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/


> StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-646
>                 URL: https://issues.apache.org/jira/browse/LANG-646
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5
>         Environment: Irrelevant
>            Reporter: polygenelubricants
>            Priority: Minor
>
> CODE TO REPRODUCE BUG:
> {noformat}
> System.out.println("\45");
> // %
> System.out.println(StringEscapeUtils.unescapeJava("\\45"));
> // 45, should be %
> StringEscapeUtils.unescapeJava("\\uu0030"));
> // throws NestableRuntimeException:
> {noformat}
> This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.
> REFERENCES:
> 3.10.6 Escape Sequences for Character and String Literals
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6
> 3.3 Unicode Escapes
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3
> EXTERNAL LINKS:
> http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LANG-646) StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u

Posted by "polygenelubricants (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

polygenelubricants updated LANG-646:
------------------------------------

    Description: 
CODE TO REPRODUCE BUG:

{noformat}
System.out.println(
    "\45".equals(StringEscapeUtils.unescapeJava("\\45"))
); // false

System.out.println(
    StringEscapeUtils.unescapeJava("\\uu0030")
); // throws NestableRuntimeException:
{noformat}

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

EXTERNAL LINKS:

http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

  was:
(Note: there seems to be a bug in the issue tracker where a double backslash is rendered as newline separator instead.)

CODE TO REPRODUCE BUG:

{noformat}
System.out.println(
"\45".equals(StringEscapeUtils.unescapeJava("\\45"))
); // false

System.out.println(
StringEscapeUtils.unescapeJava("\\uu0030")
); // throws NestableRuntimeException:
{noformat}

This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.

REFERENCES:

3.10.6 Escape Sequences for Character and String Literals
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6

3.3 Unicode Escapes
http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3

EXTERNAL LINKS:

http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/


> StringEscapeUtils.unescapeJava doesn't handle octal escapes and Unicode with extra u
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-646
>                 URL: https://issues.apache.org/jira/browse/LANG-646
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 2.5
>         Environment: Irrelevant
>            Reporter: polygenelubricants
>            Priority: Minor
>
> CODE TO REPRODUCE BUG:
> {noformat}
> System.out.println(
>     "\45".equals(StringEscapeUtils.unescapeJava("\\45"))
> ); // false
> System.out.println(
>     StringEscapeUtils.unescapeJava("\\uu0030")
> ); // throws NestableRuntimeException:
> {noformat}
> This is not compliant with the JLS, which allows both [OctalEscape] and extraneous u for [UnicodeMarker] in Java string literal.
> REFERENCES:
> 3.10.6 Escape Sequences for Character and String Literals
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.6
> 3.3 Unicode Escapes
> http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.3
> EXTERNAL LINKS:
> http://stackoverflow.com/questions/3537706/howto-unescape-a-java-string-literal-in-java/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.