YAML Test Matrix

Test #H3Z8 - Literal unicode

YAML

---
wanted: love ♥ and peace ☮

Expected Events

+STR
+DOC ---
+MAP
=VAL :wanted
=VAL :love ♥ and peace ☮
-MAP
-DOC
-STR

Expected JSON

{
"wanted" : "love \u00e2\u0099\u00a5 and peace \u00e2\u0098\u00ae"
}

cpp-event

 ok

java-event

 ok

java-json

 json_ok

js-yaml-json

 json_ok

libyaml-event

 ok

luajit-json

 json_ok

nimyaml-event

 ok

perl5-pegex-event

 ok

perl5-pm-json

 json_diff
{
   "wanted" : "love \u00c3\u00a2\u00c2\u0099\u00c2\u00a5 and peace \u00c3\u00a2\u00c2\u0098\u00c2\u00ae"
}

perl5-pm-pl

 n/a
{
  'wanted' => 'love ♥ and peace ☮'
}

perl5-pp-event

 error
+STR
+DOC ---
+MAP
=VAL :wanted
Line      : 2
Message   : Expected (COMMENT EOL), but got Invalid plain scalar
Where     : /lib/perl5/YAML/PP/Parser.pm line 487
YAML      : "\231\245 and peace \342\230\256"
  at /bin/perl5-pp-event line 18.

perl5-pp-json

 error
Line      : 2
Message   : Expected (COMMENT EOL), but got Invalid plain scalar
Where     : /lib/perl5/YAML/PP/Parser.pm line 487
YAML      : "\231\245 and peace \342\230\256"
  at /lib/perl5/YAML/PP/Loader.pm line 52.

perl5-pp-pl

 error
Line      : 2
Message   : Expected (COMMENT EOL), but got Invalid plain scalar
Where     : /lib/perl5/YAML/PP/Parser.pm line 487
YAML      : "\231\245 and peace \342\230\256"
  at /lib/perl5/YAML/PP/Loader.pm line 52.

perl5-syck-json

 json_diff
{
   "wanted" : "love \u00c3\u00a2\u00c2\u0099\u00c2\u00a5 and peace \u00c3\u00a2\u00c2\u0098\u00c2\u00ae"
}

perl5-syck-pl

 n/a
{
  'wanted' => 'love ♥ and peace ☮'
}

perl5-tiny-json

 json_diff
{
   "wanted" : "love \u00c3\u00a2\u00c2\u0099\u00c2\u00a5 and peace \u00c3\u00a2\u00c2\u0098\u00c2\u00ae"
}

perl5-tiny-pl

 n/a
{
  'wanted' => "love \x{e2}\x{99}\x{a5} and peace \x{e2}\x{98}\x{ae}"
}

perl5-xs-json

 json_ok

perl5-xs-pl

 n/a
{
  'wanted' => "love \x{2665} and peace \x{262e}"
}

pyyaml-event

 error
+STR
+DOC ---
+MAP
=VAL :wanted
=VAL
Traceback (most recent call last):
  File "/bin/pyyaml-event", line 55, in <module>
    sys.stdout.write(' ' + style + value)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2665' in position 7: ordinal not in range(128)

pyyaml-json

 json_diff
{
   "wanted" : "love \u2665 and peace \u262e"
}

pyyaml-py

 n/a
{'wanted': u'love \u2665 and peace \u262e'}

ruamel-event

 error
+STR
+DOC ---
+MAP
=VAL :wanted
=VAL
Traceback (most recent call last):
  File "/bin/ruamel-event", line 54, in <module>
    sys.stdout.write(' ' + style + value)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2665' in position 7: ordinal not in range(128)

ruamel-json

 json_diff
{
   "wanted" : "love \u2665 and peace \u262e"
}

ruamel-py

 n/a
{'wanted': u'love \u2665 and peace \u262e'}

ruby-json

 json_ok