ldh0826 / snakeyaml

Automatically exported from code.google.com/p/snakeyaml
Apache License 2.0
0 stars 0 forks source link

crash when loading yaml containing iOS emoji #205

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. prepare a file with iOS emoji, e.g.

text: "😷😊"

2. Yaml yaml = new Yaml(); yaml.load(THAT_FILE)

What is the expected output? What do you see instead?
It should load the file, but it throw "unacceptable character '�' (0xD83D) 
special characters are not allowed" instead.

What version of SnakeYAML are you using? On what Java version?
snakeyaml-1.10-android, with Android 4.4.4

Please provide any additional information below. (Often a failing test is
the best way to describe the problem.)
the string containing emoji is double-quote wrapped, and the file is generated 
by yaml.dump(Map<String, String>). The yaml file is attached.

Original issue reported on code.google.com by snow.hel...@gmail.com on 1 Feb 2015 at 3:19

Attachments:

GoogleCodeExporter commented 8 years ago
According to the specification http://yaml.org/spec/1.1/#id868524 (5.1. 
Character Set):
The allowed character range explicitly excludes the surrogate block 
#xD800-#xDFFF

As you can see 0xD83D falls exactly into this range.

Original comment by py4fun@gmail.com on 2 Feb 2015 at 3:28

GoogleCodeExporter commented 8 years ago
This is clearly a problem for iOS emoji. Apple should follow the Unicode 
specification.
According to the Unicode spec 
(http://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates): 

Isolated surrogate code points have no general interpretation; consequently, no 
character code charts or names lists are provided for this range.

Original comment by py4fun@gmail.com on 4 Feb 2015 at 11:40

GoogleCodeExporter commented 8 years ago
A test was added to remember the problem:
https://code.google.com/p/snakeyaml/source/detail?r=6f147af941116e714f321a7f7744
66ecc1ef4a98

Original comment by py4fun@gmail.com on 4 Feb 2015 at 2:48