commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From PascalSchumacher <...@git.apache.org>
Subject [GitHub] commons-lang pull request #208: LANG-1066: Add shell/XSI escape/unescape sup...
Date Sun, 20 Nov 2016 11:56:04 GMT
Github user PascalSchumacher commented on a diff in the pull request:

    https://github.com/apache/commons-lang/pull/208#discussion_r88799453
  
    --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java ---
    @@ -272,6 +272,40 @@ public int translate(final CharSequence input, final int index, final
Writer out
             }
         }
     
    +    /**
    +     * Translator object for escaping Shell command language.
    +     *
    +     * @see <a href="http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html">Shell
Command Language</a>
    +     */
    +    public static final CharSequenceTranslator ESCAPE_XSI =
    +          new LookupTranslator(
    +            new String[][] {
    +              {"|", "\\|"},
    +              {"&", "\\&"},
    +              {";", "\\;"},
    +              {"<", "\\<"},
    +              {">", "\\>"},
    +              {"(", "\\("},
    +              {")", "\\)"},
    +              {"$", "\\$"},
    +              {"`", "\\`"},
    +              {"\\", "\\\\"},
    +              {"\"", "\\\""},
    +              {"'", "\\'"},
    +              {" ", "\\ "},
    +              {"\t", "\\\t"},
    +              {"\r\n", ""},
    +              {"\n", ""},
    +              {"*", "\\*"},
    +              {"?", "\\?"},
    +              {"[", "\\["},
    --- End diff --
    
    according to http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html it does not have
to be escaped


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message