Because the rule is that embedded double-quotes should be doubled.
This is essential when unescaping a CSV list.

For example, suppose one needs to escape the two fields:

abcd","efgh
zyx

This is encoded as

"abcd"",""efgh",xyz

This allows the individual fields to be recovered correctly, as the
unescaper knows that the "" pair is part of the field, not the end of
the field.

If it were

"abcd","efgh",xyz

then the unescaper would see the following fields

abcd
efgh
xyz

If the quoting character (double-quote) is not escaped (by doubling
it) then it's not possible in general to determine what the unescaped
fields should be.

>  -v
>
>
>  On Tue, Nov 4, 2008 at 8:35 PM, sebb <[EMAIL PROTECTED]> wrote:
>
>  > Just happened to notice that StringUtils.unescapeCsv() does not check
>  > that embedded double-quotes occur in pairs.
>  >
>  > Should this condition be detected, and if so, what should happen?
>  > Throw an Exception? Return the original string untranslated?
>  > Just document the behaviour?
>  >
>  > At present the string <"foo"bar"> is returned as <foo"bar>.
>  >
>
> > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>
>
>  --
>  The first right of human is the right of EGO.
>
> --
>  http://www.xperienceexperience.blogspot.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to