I believe I have a valid yml translation file that won't parse because of a special character. For an example "switchfrench: 'Français'" fails to load with the error, couldn't parse YAML at line 1 column 0. The yml file "switchfrench: 'Francais'" loads correctly.

https://gist.github.com/2415270

Any ideas on how to get this to parse?

有帮助吗?

解决方案

Ok, so this works:

1.9.3p125 :008 > YAML.load("switchfrench: Français\n")
 => {"switchfrench"=>"Français"} 

What if you tried writing that to disk from the console, like this:

File.open('config/locales/app.fr.yml', 'w') {|f| f << "switchfrench: Français\n" }
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top