Chinese Characters with YAML

452 views
Skip to first unread message

Connor Tumbleson

unread,
Jan 22, 2013, 8:15:00 AM1/22/13
to snakeya...@googlegroups.com
I haven't add any luck yet supporting Chinese chars, I looked over documentation and Unicode is enabled by default so confused as to why it doesn't work.

I get a nasty stacktrace like this.

Exception in thread "main" org.yaml.snakeyaml.error.YAMLException: java.nio.char
set.MalformedInputException: Input length = 1
        at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:200)
        at org.yaml.snakeyaml.reader.StreamReader.<init>(StreamReader.java:60)
        at org.yaml.snakeyaml.Yaml.load(Yaml.java:412)

Caused by: java.nio.charset.MalformedInputException: Input length = 1
        at java.nio.charset.CoderResult.throwException(CoderResult.java:260)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:319)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:123)
        at java.io.Reader.read(Reader.java:123)
        at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:184)
        ... 7 more

Andrey

unread,
Jan 22, 2013, 8:55:45 AM1/22/13
to snakeya...@googlegroups.com
Hi,
SnakeYAML has a zillion of tests that check the whole Unicode set.
(we have happy users in China :)

I am afraid you do not use Unicode properly. If you create your own Reader do not forget to specify the encoding.
Feel free to submit a failing test to prove the opposite.

Cheers,
Andrey

Connor Tumbleson

unread,
Jan 22, 2013, 2:04:42 PM1/22/13
to snakeya...@googlegroups.com
Sorry bout that.

Works fine now :) 
Reply all
Reply to author
Forward
0 new messages