dtolnay / serde-yaml

Strongly typed YAML library for Rust
Apache License 2.0
965 stars 164 forks source link

Emoji serialized to Unicode escape sequence #356

Closed inflation closed 1 year ago

inflation commented 1 year ago

I have some cursed configs with emojis (don't ask me why), and need to patch those files without touching other parts. It's all good until the last serialize part. Those emojis are converted to Unicode escape sequence:

let test = '🎉';
println!("{}", serde_yaml::to_string(&test).unwrap());

Output: "\U0001F389"

Although, it's technically equivalent but not very human-readable. PyYAML has an option allow_unicode for dump to keep them. I'd love to see a similar option for serde-yaml.

dtolnay commented 1 year ago

Fixed in serde_yaml 0.9.18.