mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
reflect: fix (u)int -> string conversions for invalid code points
This commit is contained in:
committed by
Damian Gryski
parent
e111b489ec
commit
364ac2dcb2
@@ -153,7 +153,9 @@ func stringNext(s string, it *stringIterator) (bool, int, rune) {
|
||||
}
|
||||
|
||||
// Convert a Unicode code point into an array of bytes and its length.
|
||||
func encodeUTF8(x rune) ([4]byte, uintptr) {
|
||||
func encodeUTF8(r rune) ([4]byte, uintptr) {
|
||||
x := uint32(r)
|
||||
|
||||
// https://stackoverflow.com/questions/6240055/manually-converting-unicode-codepoints-into-utf-8-and-utf-16
|
||||
// Note: this code can probably be optimized (in size and speed).
|
||||
switch {
|
||||
|
||||
Reference in New Issue
Block a user