can server locale settings affect JSON parsing (Ruby) -
i have issue script parsing info stored in redis, particular hash of info has in string:
\u00a3575,000. £575,000 redis storing £ when pull out. when pass string json.parse returns error saying:
unexpected error while processing request: "\xc2" on us-ascii i have been through server , tested on our uat platform , fine, parses fine , returns expect, on live server same uat server (ruby version, rvm version, redis version) gives above error.
i have been through server settings , thing can see different locale settings (ubuntu 12.04)
on uat set en_gb.utf-8 on live set en_us.utf-8 before left office changed locale settings, ran out of time reboot server , can't until tomorrow morning (its ip locked ssh office). coders know, can't stop thinking problem, hence coming inquire here if can create difference. if can't can point me in right direction come solution?
ps. did add together line:
result = result.force_encoding(encoding::utf_8) which worked sense that, didn't need on uat, feels wrong create code alter bend problem environment.
many thanks
ops: if helps reply why getting error, then: output rvm info ruby-2.1.1:
system: uname: "linux ip-10-82-168-126 3.2.0-54-virtual #82-ubuntu smp tue sep 10 20:31:18 utc 2013 x86_64 x86_64 x86_64 gnu/linux" system: "ubuntu/12.04/x86_64" bash: "/bin/bash => gnu bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)" zsh: " => not installed" rvm: version: "rvm 1.25.27 (stable) wayne e. seguin <wayneeseguin@gmail.com>, michal papis <mpapis@gmail.com> [https://rvm.io/]" updated: "3 hours 15 minutes 33 seconds ago" path: "/usr/local/rvm" ruby: interpreter: "ruby" version: "2.1.1p76" date: "2014-02-24" platform: "x86_64-linux" patchlevel: "2014-02-24 revision 45161" full_version: "ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]" homes: gem: "/usr/local/rvm/gems/ruby-2.1.1" ruby: "/usr/local/rvm/rubies/ruby-2.1.1" binaries: ruby: "/usr/local/rvm/rubies/ruby-2.1.1/bin/ruby" irb: "/usr/local/rvm/rubies/ruby-2.1.1/bin/irb" gem: "/usr/local/rvm/rubies/ruby-2.1.1/bin/gem" rake: "/usr/local/rvm/rubies/ruby-2.1.1/bin/rake" environment: path: "/usr/local/rvm/gems/ruby-2.1.1/bin:/usr/local/rvm/gems/ruby-2.1.1@global/bin:/usr/local/rvm/rubies/ruby-2.1.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local.rvm/bin:/usr/local/rvm/bin" gem_home: "/usr/local/rvm/gems/ruby-2.1.1" gem_path: "/usr/local/rvm/gems/ruby-2.1.1:/usr/local/rvm/gems/ruby-2.1.1@global" my_ruby_home: "/usr/local/rvm/rubies/ruby-2.1.1" irbrc: "/usr/local/rvm/rubies/ruby-2.1.1/.irbrc" rubyopt: "" gemset: "" ruby json redis
No comments:
Post a Comment