From 1f02e401e2e60bbe88fa51b4003c591b714ac5f5 Mon Sep 17 00:00:00 2001 From: Ferdinand Prantl Date: Sat, 16 Nov 2024 05:19:09 +0100 Subject: [PATCH] fix: Replace get_uchar with get_rune --- bench/unicode.vsh | 2 +- src/stringify.v | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bench/unicode.vsh b/bench/unicode.vsh index d9464ae..3fff43d 100755 --- a/bench/unicode.vsh +++ b/bench/unicode.vsh @@ -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()}') diff --git a/src/stringify.v b/src/stringify.v index d795849..54f1a4a 100644 --- a/src/stringify.v +++ b/src/stringify.v @@ -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)