Quantcast
Channel: WhizCreed
Viewing all articles
Browse latest Browse all 14

How to fix on OSX: US-ASCII (Encoding::InvalidByteSequenceError)

$
0
0

While trying to parse json file in my ruby script, I was getting following error:

/json/common.rb:155:in `encode’: “\xE2″ on US-ASCII (Encoding::InvalidByteSequenceError)
from /usr/local/Cellar/ruby/2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `initialize’
from /usr/local/Cellar/ruby/2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `new’
from /usr/local/Cellar/ruby/2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `parse’

JSON file contained data pulled off from web pages.

Just running the following command on my terminal fixed the issue:

 export LANG=en_US.UTF-8


Viewing all articles
Browse latest Browse all 14

Trending Articles