I think this belongs in [text]. I am not -1 but let's see how the discussion does in the other thread.
Gary ---------- Forwarded message ---------- From: britter <g...@git.apache.org> Date: Sat, Nov 19, 2016 at 3:37 AM Subject: [GitHub] commons-lang pull request #208: LANG-1066: Add shell/XSI escape/unescape sup... To: iss...@commons.apache.org Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/208#discussion_r88777926 --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java --- @@ -801,4 +876,61 @@ public static final String unescapeCsv(final String input) { return UNESCAPE_CSV.translate(input); } + // Shell + /** + * <p>Escapes the characters in a {@code String} using XSI rules.</p> + * + * <p><b>Beware!</b> In most cases you don't want to escape shell commands but use multi-argument + * methods provided by {@link java.lang.ProcessBuilder} or {@link java.lang.Runtime#exec(String[])} + * instead.</p> + * + * <p>Example:</p> + * <pre> + * input string: He didn't say, "Stop!" + * output string: He\ didn\'t\ say,\ \"Stop!\" + * </pre> + * + * @see <a href="http://pubs.opengroup.org/onlinepubs/7908799/xcu/ chap2.html">Shell Command Language</a> + * @param input String to escape values in, may be null + * @return String with escaped values, {@code null} if null string input + * @since 3.6 + */ + public static final String escapeXSI(final String input) { + return ESCAPE_XSI.translate(input); + } + + /** + * <p>Alias for {@link #escapeXSI(String)}.</p> + * + * @param input String to escape values in, may be null + * @return String with escaped values, {@code null} if null string input + * @since 3.6 + */ + public static final String escapeShell(final String input) { --- End diff -- I'm not sure whether it is a good idea to have aliases for methods. Does this help users to find what they are looking for or does this really cause confusion? --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence with Hibernate, Second Edition <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459> JUnit in Action, Second Edition <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021> Spring Batch in Action <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory