Anchor should allow non ascii charactors
Summary
When snakeyaml loads a yaml that has an anchor contains non ascii charactors like Japanese, Chinese or Germany, An following error is produced.
while scanning an anchor
in 'string', line 23, column 11:
- name: &something_タスク タスク
^
expected alphabetic or numeric character, but found タ(12479)
in 'string', line 23, column 22:
- name: &something_タスク タスク
Environment
-
java
- 1.8
-
snakeyaml
- 1.24
Expected
- Yaml specification allows non ascii characters. Snakeyaml should do so.
Detail
The javadoc of the method produces the error says following.
The specification does not restrict characters for anchors and
aliases. This may lead to problems, for instance, the document:
[ *alias, value ]
can be interpreted in two ways, as
[ "value" ]
and
[ *alias , "value" ]
Therefore we restrict aliases to numbers and ASCII letters.
But yaml 1.2 defines exclude characters “,“ , ”[” , “]“ , “{“ , “}“ for anchors to avoid the problem.
https://yaml.org/spec/1.2/spec.html#id2785586
Snakeyaml may follow yaml 1.1. But current implementation is neither following yaml 1.1 nor 1.2.
The best way to avoid problems caused from flow characters should follow yaml 1.2 specification.
Comments (5)
-
-
Account Deactivated reporter Awesome! Thanks for fixing so fast.
-
Account Deactivated It will be released with version 1.26 in February 2020
-
Account Deactivated reporter Thank you for informing me the schedule.
I’m looking forward the next release.
-
Please be aware that it will be changed.
See https://bitbucket.org/asomov/snakeyaml/issues/485/alias-names-are-too-permissive-compared-to
- Log in to comment
Fixed.
https://bitbucket.org/asomov/snakeyaml/wiki/Changes
Feel free to check the latest code or SNAPHOT.