Rails 3.0.12 translation file won't parse with “couldn't parse YAML at line 1 column 0”
-
01-06-2021 - |
题
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" }
不隶属于 StackOverflow