aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/unicode
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2012-08-30 11:16:55 -0700
committerRob Pike <r@golang.org>2012-08-30 11:16:55 -0700
commit363ec80dec5908ed7feebba448dc8e5b2cf90740 (patch)
tree41fefee45d70de22da282fd8593b2912ea725d18 /src/pkg/unicode
parentb7627d3d1f238e484d08bb8abb770cbe91482bc4 (diff)
downloadgo-363ec80dec5908ed7feebba448dc8e5b2cf90740.tar.xz
cmd/gc: string conversion for surrogates
This is required by the spec to produce the replacement char. The fix lies in lib9's rune code. R=golang-dev, nigeltao, rsc CC=golang-dev https://golang.org/cl/6443109
Diffstat (limited to 'src/pkg/unicode')
-rw-r--r--src/pkg/unicode/utf8/utf8_test.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pkg/unicode/utf8/utf8_test.go b/src/pkg/unicode/utf8/utf8_test.go
index e9b30a20cb..c516871c99 100644
--- a/src/pkg/unicode/utf8/utf8_test.go
+++ b/src/pkg/unicode/utf8/utf8_test.go
@@ -69,7 +69,7 @@ var utf8map = []Utf8Map{
var surrogateMap = []Utf8Map{
{0xd800, "\xed\xa0\x80"}, // surrogate min decodes to (RuneError, 1)
- {0xdfff, "\xed bf bf"}, // surrogate max decodes to (RuneError, 1)
+ {0xdfff, "\xed\xbf\xbf"}, // surrogate max decodes to (RuneError, 1)
}
var testStrings = []string{
@@ -355,7 +355,9 @@ var validTests = []ValidTest{
{string([]byte{66, 250}), false},
{string([]byte{66, 250, 67}), false},
{"a\uFFFDb", true},
- {string("\xF7\xBF\xBF\xBF"), true}, // U+1FFFFF
+ {string("\xF4\x8F\xBF\xBF"), true}, // U+10FFFF
+ {string("\xF4\x90\x80\x80"), false}, // U+10FFFF+1; out of range
+ {string("\xF7\xBF\xBF\xBF"), false}, // 0x1FFFFF; out of range
{string("\xFB\xBF\xBF\xBF\xBF"), false}, // 0x3FFFFFF; out of range
{string("\xc0\x80"), false}, // U+0000 encoded in two bytes: incorrect
{string("\xed\xa0\x80"), false}, // U+D800 high surrogate (sic)