mirror of
https://github.com/tinygo-org/net.git
synced 2026-08-19 03:53:56 +00:00
update with changes from go1.20.5 to go1.21.4
This commit is contained in:
committed by
deadprogram
parent
be25e1a28e
commit
7c11b88ce6
+9
-3
@@ -1,4 +1,4 @@
|
||||
// TINYGO: The following is copied from Go 1.20.5 official implementation.
|
||||
// TINYGO: The following is copied from Go 1.21.4 official implementation.
|
||||
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
@@ -88,14 +88,20 @@ func hexEscapeNonASCII(s string) string {
|
||||
return s
|
||||
}
|
||||
b := make([]byte, 0, newLen)
|
||||
var pos int
|
||||
for i := 0; i < len(s); i++ {
|
||||
if s[i] >= utf8.RuneSelf {
|
||||
if pos < i {
|
||||
b = append(b, s[pos:i]...)
|
||||
}
|
||||
b = append(b, '%')
|
||||
b = strconv.AppendInt(b, int64(s[i]), 16)
|
||||
} else {
|
||||
b = append(b, s[i])
|
||||
pos = i + 1
|
||||
}
|
||||
}
|
||||
if pos < len(s) {
|
||||
b = append(b, s[pos:]...)
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user