- changed status to resolved
Anchor should allow non ascii charactors while dumping
Issue #480
resolved
Summary
On the below issue, anchor can contain non ascii characters like Japanese.
https://bitbucket.org/asomov/snakeyaml/issues/468/anchor-should-allow-non-ascii-charactors
But while dumping, if anchor contains non ascii characters, snakeyaml thorws EmmiterException from org.yaml.snakeyaml.emitter.Emitter#prepareAnchor.
It should be allowed to contains non ascii characters while dumping.
Environment
-
java
- 1.8
-
snakeyaml
- 1.26
Expected
- Yaml specification allows non ascii characters. Snakeyaml should do so.
How to produce
public void dump_non_ascii() {
DumperOptions options = new DumperOptions();
options.setAnchorGenerator(new AnchorGenerator() {
int id = 0;
@Override
public String nextAnchor(Node node) {
return "タスク" + id++;
}
});
Yaml yaml = new Yaml(options);
List<String> list = new ArrayList<>();
list.add("abc");
List<List<String>> toExport = new ArrayList<>();
toExport.add(list);
toExport.add(list);
yaml.dump(toExport);
}
Comments (4)
-
-
Feel free to test the latest code.
It will be delivered in version 1.27
-
reporter Thank your for your very fast fixing and perfect work.
I’m looking for the next release.
-
- Log in to comment
Fix issue 480: allow non ASCII chars in anchors
→ <<cset 7266f451317c>>