Subject: | back quote is a reserved character |
Scalars with a leading back quote are not dumped in compliance with YAML
1.1 spec. Issue was found when using SnakeYAML to read YAML::Syck
output. Here's how to reproduce the bug:
perl -MYAML::Syck -e 'print YAML::Syck::Dump({ foo => "`bar" })'
The buggy output under 1.07 is:
---
foo: `bar
The correct output quotes the scalar:
---
foo: "`bar"
This patch fixes the bug (produces the correct output above):
diff -ur YAML-Syck-1.07/emitter.c YAML-Syck-1.07-fox/emitter.c
--- YAML-Syck-1.07/emitter.c 2008-02-16 07:50:36.000000000 -0500
+++ YAML-Syck-1.07-fox/emitter.c 2009-07-16 10:41:05.000000000 -0400
@@ -565,7 +565,7 @@
cursor[0] == '&' || cursor[0] == '|' ||
cursor[0] == '>' || cursor[0] == '\'' ||
cursor[0] == '"' || cursor[0] == '#' ||
- cursor[0] == '%' || cursor[0] == '@' ||
+ cursor[0] == '%' || cursor[0] == '@' || cursor[0] == '`' ||
cursor[0] == '&' || cursor[0] == '^' ) {
flags |= SCAN_INDIC_S;
}