You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/12/25 18:54:58 UTC

[jira] [Commented] (LANG-1303) Escape HTML characters only once

    [ https://issues.apache.org/jira/browse/LANG-1303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15776913#comment-15776913 ] 

ASF GitHub Bot commented on LANG-1303:
--------------------------------------

GitHub user SampannaKahu opened a pull request:

    https://github.com/apache/commons-lang/pull/222

    LANG-1303 : Escape HTML characters once

    Hi, this is my first time contributing to any open source project.
    The feature goes as follows:
    
    If already escaped HTML characters are in the input test, they get escaped again using StringEscapeUtils.escapeHtml4().
    
    For example:
    If the input is:
    100 kg &lt; 1000kg
    Then the output of escapeHtml4() becomes:
    100kg &amp;lt; 1000kg
    
    At my workplace, we felt the need for a method in StringEscapeUtils which does not escape already escaped characters.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/SampannaKahu/commons-lang escape_html_once

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/222.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #222
    
----
commit a5786ee8bab5b06e53ddc436326fef3cd8f2adfa
Author: SampannaKahu <sa...@gmail.com>
Date:   2016-12-23T19:00:47Z

    Adding a new html4 translator to escape HTML characters only once.
    This prevents single, double or recursive escaping of html characters.

commit a198671e2d4ced8d4363f5d7fd2aa3f60d236f16
Author: SampannaKahu <sa...@gmail.com>
Date:   2016-12-23T19:25:47Z

    1. Using SingleLookupTranslator directly, instead of passing it to AggregateTranslator.
    2. Added escapeHtml3Once() method.
    3. Commenting improvements.

commit 4b21f7c5a1384bf6ced59121f1c36c962c3c939a
Author: SampannaKahu <sa...@gmail.com>
Date:   2016-12-25T18:43:16Z

    Merge branch 'escape_html_once' of https://github.com/SampannaKahu/commons-lang into escape_html_once

----


> Escape HTML characters only once
> --------------------------------
>
>                 Key: LANG-1303
>                 URL: https://issues.apache.org/jira/browse/LANG-1303
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.text.*
>            Reporter: Sampanna Kahu
>            Priority: Minor
>              Labels: features, newbie
>
> If already escaped HTML characters are in the input test, they get encoded again using StringEscapeUtils.escapeHtml4().
> For example:
> If the input is:
> 100 kg &lt; 1000kg
> Then the output of escapeHtml4 becomes:
> 100kg &amp;lt; 1000kg
> At my workplace, we felt the need for a method in StringEscapeUtils which does not escape already escaped characters.
> I have attempted to create this method. Creating a pull request soon.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)