-
-
Notifications
You must be signed in to change notification settings - Fork 868
Open
Description
Context
Odin: dev-2025-08:fb4641307
OS: Linux Mint 22.1, Linux 6.8.0-90-generic
CPU: Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
RAM: 15929 MiB
Backend: LLVM 20.1.8
Json marshal correctly handles runes, unmarshal doesn't.
package json_rune
import "core:encoding/json"
import "core:fmt"
main :: proc() {
m := marshal_rune()
unmarshal_rune(m)
}
marshal_rune :: proc() -> []u8 {
val, err := json.marshal('a')
if err != nil {
fmt.eprintln("Error, json marshal not working with runes")
} else {
fmt.println("json marshal works with runes:", string(val))
}
return val
}
unmarshal_rune :: proc(data: []u8) {
r: rune
err := json.unmarshal(data, &r)
if err != nil {
fmt.eprintln("error, json unmarshal not working with runes")
} else {
fmt.println("json unmarshal works with runes:", r)
}
}
Expected Behavior
json marshal works with runes: "a"
json unmarshal works with runes: a
or
Error, json marshal not working with runes
error, json unmarshal not working with runes
Current Behavior
json marshal works with runes: "a"
error, json unmarshal not working with runes
Steps to Reproduce
Run the sample code above with odin run .
Metadata
Metadata
Assignees
Labels
No labels