golang_str,strconv: Fix decoding of rune-error
Error rune (u+fffd) is returned by _utf8_decode_rune to indicate an error in decoding. But the error rune itself is valid unicode codepoint: >>> x = u"�" >>> x u'\ufffd' >>> x.encode('utf-8') '\xef\xbf\xbd' This way only (r=_rune_error, size=1) should be treated by the caller as utf8 decoding error. But e.g. strconv.quote was not careful to also inspect the size, and this way was quoting � into just "\xef" instead of "\xef\xbf\xbd". _utf8_decode_surrogateescape was also subject to similar error. -> Fix it. Without the fix e.g. added test for strconv.quote fails as > assert quote(tin) == tquoted E assert '"\xef"' == '"�"' E - "\xef" E + "�" /reviewed-by @jerome /reviewed-at !18
Status | Job ID | Name | Coverage | ||||||
---|---|---|---|---|---|---|---|---|---|
External | |||||||||
passed |
#525054
external
|
Pygolang.UnitTest-Master.Python2 |
00:01:13
|
||||||
passed |
#525031
external
|
Pygolang.UnitTest-Master.Python3 |
00:01:38
|
||||||
passed |
#524884
external
retried
|
Pygolang.UnitTest-Master.Python2 |
00:01:19
|
||||||
passed |
#524934
external
retried
|
Pygolang.UnitTest-Master.Python2 |
00:01:11
|
||||||
passed |
#524883
external
retried
|
Pygolang.UnitTest-Master.Python3 |
00:01:46
|
||||||
passed |
#524946
external
retried
|
Pygolang.UnitTest-Master.Python3 |
00:01:32
|
||||||