• Joe Tsai's avatar
    encoding/csv: avoid mangling invalid UTF-8 in Writer · 0add9a4d
    Joe Tsai authored
    In the situation where a quoted field is necessary, avoid processing
    each UTF-8 rune one-by-one, which causes mangling of invalid sequences
    into utf8.RuneError, causing a loss of information.
    Instead, search only for the escaped characters, handle those specially
    and copy everything else in between verbatim.
    
    This symmetrically matches the behavior of Reader.
    
    Fixes #24298
    
    Change-Id: I9276f64891084ce8487678f663fad711b4095dbb
    Reviewed-on: https://go-review.googlesource.com/99297
    Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    0add9a4d
Name
Last commit
Last update
..
ascii85 Loading commit data...
asn1 Loading commit data...
base32 Loading commit data...
base64 Loading commit data...
binary Loading commit data...
csv Loading commit data...
gob Loading commit data...
hex Loading commit data...
json Loading commit data...
pem Loading commit data...
xml Loading commit data...
encoding.go Loading commit data...