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 2019/09/07 06:24:00 UTC

[jira] [Work logged] (TEXT-149) StringEscapeUtils.unescapeCsv doesn't remove quotes at begin and end of string

     [ https://issues.apache.org/jira/browse/TEXT-149?focusedWorklogId=308308&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-308308 ]

ASF GitHub Bot logged work on TEXT-149:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Sep/19 06:23
            Start Date: 07/Sep/19 06:23
    Worklog Time Spent: 10m 
      Work Description: yuji-k64613 commented on pull request #119: TEXT-149: StringEscapeUtils.unescapeCsv doesn't remove quotes at begin and end of string
URL: https://github.com/apache/commons-text/pull/119
 
 
   Fixed StringEscapeUtils.unescapeCsv remove quotes at begin and end of string.
   
   "foo,bar" -> foo,bar
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 308308)
    Remaining Estimate: 0h
            Time Spent: 10m

> StringEscapeUtils.unescapeCsv doesn't remove quotes at begin and end of string
> ------------------------------------------------------------------------------
>
>                 Key: TEXT-149
>                 URL: https://issues.apache.org/jira/browse/TEXT-149
>             Project: Commons Text
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Krzysztof Szalast
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> org.apache.commons.text.translate.CsvTranslators:
> {code:java}
> void translateWhole(CharSequence input, Writer out) throws IOException {
>     if (input.charAt(0) == '"' && input.charAt(input.length() - 1) == '"') {
>         String quoteless = input.subSequence(1, input.length() - 1).toString();
>         if (StringUtils.containsAny(quoteless, CsvTranslators.CSV_SEARCH_CHARS)) {
>             out.write(StringUtils.replace(quoteless, CsvTranslators.CSV_ESCAPED_QUOTE_STR, CsvTranslators.CSV_QUOTE_STR));
>         } else {
>             out.write(input.toString());
>         }
>     } else {
>         out.write(input.toString());
>     }
> }{code}
>  
> In my opinion first occurence "out.write(input.toString());" should be replaced with:
> {code:java}
> out.write(quoteless.toString());{code}
> Because '"' quotes around "input" will be never removed.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)