You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Quintin Beukes (JIRA)" <ji...@apache.org> on 2008/07/01 10:07:45 UTC

[jira] Created: (LANG-448) Lower Ascii Characters don't get encoded by Entities.java

Lower Ascii Characters don't get encoded by Entities.java
---------------------------------------------------------

                 Key: LANG-448
                 URL: https://issues.apache.org/jira/browse/LANG-448
             Project: Commons Lang
          Issue Type: Bug
    Affects Versions: 2.4
         Environment: N/A
            Reporter: Quintin Beukes


I have an XML files which sometimes contain control characters like 0x0c, or 0x18. These aren't allowed to be directly in the file (the validator fails with invalid character), so they need to be escaped.

When using "StringEscapeUtils.escapeXml(String str)", which in turn uses "Entities.escape(Writer writer, String str)", these characters don't get escaped. Only characters above 0x7F get escaped.

I fixed this bug, and attached a patch.

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


[jira] Updated: (LANG-448) Lower Ascii Characters don't get encoded by Entities.java

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

Quintin Beukes updated LANG-448:
--------------------------------

    Attachment: lowerascii.patch

Patch to cause lower ascii characters to be encoded.

Boils down to: if (c >= 0x7F || (c < 0x20 && c != 0x0A && c != 0x0D))

> Lower Ascii Characters don't get encoded by Entities.java
> ---------------------------------------------------------
>
>                 Key: LANG-448
>                 URL: https://issues.apache.org/jira/browse/LANG-448
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>         Environment: N/A
>            Reporter: Quintin Beukes
>         Attachments: lowerascii.patch
>
>
> I have an XML files which sometimes contain control characters like 0x0c, or 0x18. These aren't allowed to be directly in the file (the validator fails with invalid character), so they need to be escaped.
> When using "StringEscapeUtils.escapeXml(String str)", which in turn uses "Entities.escape(Writer writer, String str)", these characters don't get escaped. Only characters above 0x7F get escaped.
> I fixed this bug, and attached a patch.

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


[jira] Updated: (LANG-448) Lower Ascii Characters don't get encoded by Entities.java

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

Henri Yandell updated LANG-448:
-------------------------------

    Fix Version/s: 3.0

> Lower Ascii Characters don't get encoded by Entities.java
> ---------------------------------------------------------
>
>                 Key: LANG-448
>                 URL: https://issues.apache.org/jira/browse/LANG-448
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>         Environment: N/A
>            Reporter: Quintin Beukes
>             Fix For: 3.0
>
>         Attachments: lowerascii.patch
>
>
> I have an XML files which sometimes contain control characters like 0x0c, or 0x18. These aren't allowed to be directly in the file (the validator fails with invalid character), so they need to be escaped.
> When using "StringEscapeUtils.escapeXml(String str)", which in turn uses "Entities.escape(Writer writer, String str)", these characters don't get escaped. Only characters above 0x7F get escaped.
> I fixed this bug, and attached a patch.

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


[jira] Commented: (LANG-448) Lower Ascii Characters don't get encoded by Entities.java

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

Joerg Schaible commented on LANG-448:
-------------------------------------

This patch is only valid, if you operate with XML 1.0. For XML 1.1 the allowed character set is different. See LANG-66 with a related change.

> Lower Ascii Characters don't get encoded by Entities.java
> ---------------------------------------------------------
>
>                 Key: LANG-448
>                 URL: https://issues.apache.org/jira/browse/LANG-448
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>         Environment: N/A
>            Reporter: Quintin Beukes
>         Attachments: lowerascii.patch
>
>
> I have an XML files which sometimes contain control characters like 0x0c, or 0x18. These aren't allowed to be directly in the file (the validator fails with invalid character), so they need to be escaped.
> When using "StringEscapeUtils.escapeXml(String str)", which in turn uses "Entities.escape(Writer writer, String str)", these characters don't get escaped. Only characters above 0x7F get escaped.
> I fixed this bug, and attached a patch.

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


[jira] Closed: (LANG-448) Lower Ascii Characters don't get encoded by Entities.java

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

Henri Yandell closed LANG-448.
------------------------------

    Resolution: Fixed

Rewrite in LANG-505 supports the user choosing not to do this easily.

LANG-515 to define how XML should be escaped by default. Or whether to support XML_1_0 and XML_1_1.

> Lower Ascii Characters don't get encoded by Entities.java
> ---------------------------------------------------------
>
>                 Key: LANG-448
>                 URL: https://issues.apache.org/jira/browse/LANG-448
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.4
>         Environment: N/A
>            Reporter: Quintin Beukes
>             Fix For: 3.0
>
>         Attachments: lowerascii.patch
>
>
> I have an XML files which sometimes contain control characters like 0x0c, or 0x18. These aren't allowed to be directly in the file (the validator fails with invalid character), so they need to be escaped.
> When using "StringEscapeUtils.escapeXml(String str)", which in turn uses "Entities.escape(Writer writer, String str)", these characters don't get escaped. Only characters above 0x7F get escaped.
> I fixed this bug, and attached a patch.

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