aboutsummaryrefslogtreecommitdiff
path: root/core/strings/strings.odin
diff options
context:
space:
mode:
authorJacob Friedman <jacobjf01@gmail.com>2025-02-04 15:44:42 +0100
committerJacob Friedman <jacobjf01@gmail.com>2025-02-04 15:49:23 +0100
commit4c0b145bad3a49d3110ddc18c0dae2e59dcf05e4 (patch)
tree842018ff362c6086fe4113e52cda241b330573a9 /core/strings/strings.odin
parent239c511ce9e580384eca804596dfaf227f98c807 (diff)
Fix unicode handling
Diffstat (limited to 'core/strings/strings.odin')
-rw-r--r--core/strings/strings.odin7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/strings/strings.odin b/core/strings/strings.odin
index 9e7ea6ac1..b050262f0 100644
--- a/core/strings/strings.odin
+++ b/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