瀏覽代碼

Fix unicode handling

Jacob Friedman 8 月之前
父節點
當前提交
4c0b145bad
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      core/strings/strings.odin

+ 6 - 1
core/strings/strings.odin

@@ -1033,7 +1033,12 @@ Returns:
 _split_iterator :: proc(s: ^string, sep: string, sep_save: int) -> (res: string, ok: bool) {
 	m := index(s^, sep)
 	if sep == "" {
-		m = 1 if len(s) > 0 else -1
+		if len(s) == 0 {
+			m = -1
+		} else {
+			_, w := utf8.decode_rune_in_string(s^)
+			m = w
+		}
 	}
 	if m < 0 {
 		// not found