Skip to content

Commit

Permalink
fix: Replace get_uchar with get_rune
Browse files Browse the repository at this point in the history
  • Loading branch information
prantlf committed Nov 16, 2024
1 parent 35f108f commit 1f02e40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bench/unicode.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn print_unicode(s string) {
println(s.len_utf8())
println(s.bytes())
println(s.runes())
utf32 := utf8.get_uchar(s, 0)
utf32 := utf8.get_rune(s, 0)
println(utf32.hex())
high, low := utf32_to_utf16(u32(utf32))
println('${high.hex()} ${low.hex()}')
Expand Down
2 changes: 1 addition & 1 deletion src/stringify.v
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fn write_string(mut builder Builder, s string, opts &StringifyOpts, include_quot
} else if escape_unicode {
builder.write_u8(`\\`)
builder.write_u8(`u`)
utf32 := u32(utf8.get_uchar(s, cur))
utf32 := u32(utf8.get_rune(s, cur))
mut buf := []u8{len: 4}
if utf32 < 0x10000 {
u16_to_hex(u16(utf32), mut buf)
Expand Down

0 comments on commit 1f02e40

Please # to comment.