Ruby error UTF-8 to ASCII
RDoc updated last week, and was supposed to help fix encoding problems.
Try gem update rdoc
and see if that helps.
`write': \xCF from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError) while writing to file from url
Use force_encoding
:
open(uri) {|url_file| tempfile.write(url_file.read.force_encoding("UTF-8"))
Error: Incompatible character encodings: UTF-8 and ASCII-8BIT
In the file boot.rb
, I added this line:
ENV['NLS_LANG'] = 'AMERICAN_AMERICA.UTF8'
Whit this I solved my problem.
\x90 from ASCII-8BIT to UTF-8 error rails
So after hours trying to find out what the problem is, I have figured this out.
The problem was the part where I tried to encode my hash to JSON. Apparently Rails or my application do not understand the .to_json
method, so I had to use the JSON.generate(data)
serialization as described here: http://ruby-doc.org/stdlib-2.0.0/libdoc/json/rdoc/JSON.html#module-JSON-label-Generating+JSON
Related Topics
Getting a List of Classes That Include a Module
Does Ruby Have Syntax for Safe Navigation Operator of Nil Values, Like in Groovy
Obtaining a Facebook Auth Token for a Command-Line (Desktop) Application
Is Regexp.Last_Match Thread Safe
Missing File in Gem After Build
How to Get the Final Url After Redirects Using Ruby
Errno::Eaccess: Permission Denied @ Dir_S_Mkdir
Declaring an Integer Range with Step != 1 in Ruby
Why Aren't Global (Dollar-Sign $) Variables Used
How Can Bundler/Gemfile Be Configured to Use Different Gem Sources During Development
How to Render File in Rails 5 API
Accepts_Nested_Attributes_For Ignore Blank Values
Ruby Dot Parenthesis Call Syntax
How to Preserve Case with Http.Get
What Can a Ruby Symbol (Syntax) Contain