Yams
Yams copied to clipboard
Unicode chars
It doesn't work with emojis and Japanese characters.
Can you please share more information for us to look into this as a possible issue?
For what it's worth we have tests validating some multi-byte unicode character use cases: https://github.com/jpsim/Yams/blob/5fa313eae1ca127ad3c706e14c564399989cb1b1/Tests/YamsTests/SpecTests.swift#L19-L36
I got something [wrong/not working as expect] with it I think
(PTFoundation.CodeClip) $R0 = {
name = "测试/1"
code = "echo \'test\'"
section = "测试栏目+:/\\!#@$%#^$*(*&)"
executor = nil
target = nil
targetLink = 0 values {}
}
resulting
name: "\u6D4B\u8BD5/1"
code: echo 'test'
section: "\u6D4B\u8BD5\u680F\u76EE+:/\\!#@$%#^$*(*&)"
executor: unknown
target: unknown
link: []
@Lakr233 as a workaround, you can apply a transformation to convert the Unicode codes into valid chars:
extension StringTransform {
static let unicodeToAny = StringTransform("Hex-Any")
}
let yamlString = try? YAMLEncoder().encode(object)
return yamlString?.applyingTransform(.unicodeToAny, reverse: false)