Ruby yaml cannot read unicode -
Ruby yaml cannot read unicode -
i have settings.yml file elasticsearch , need inlcude this:
char_filter: arabic_normalization_extra: type: mapping mappings: [ "\x{670}=>ا", "ٰ=>ا", "ٱ=>ا", "آ=>ا", "ٖ=>ا" ]
ruby throws error , unhappy this:
psych::syntaxerror: (<unknown>): did not find expected hexdecimal number while parsing quoted scalar @ line 9 column 28
how can around this?
thanks!
i used yam extensively unicode , works pretty well. utilize load utf-8 encoded file:
yaml::load(file.open(filepath, 'r:utf-8'))
here have error when ruby tries parse \x{670}
\x
escape sequence in ruby strings. used represent byte 2 digit hexadecimal number.
so \x
followed {
invalid , that's why ruby throws error.
a working illustration \x67
corresponds g
i think question inquire why have curly braces in string? , initial string before encoded in yaml file.
ruby-on-rails ruby
Comments
Post a Comment