"Encoding::Invalidbytesequenceerror" Error Occurs in Rails 3.1.0

Encoding::InvalidByteSequenceError error occurs in Rails 3.1.0

Change the version of execjs to 1.2.4, 1.2.6 or 1.2.8 in Gemfile.lock

Only 1.2.7 will cause the problem.

Hope this helps.

Encoding::InvalidByteSequenceError in Home#index \xA9 on UTF-8

So, I solved this by reinstalling the Ruby application.

Don't know what had caused it, but I just reinstalled the application and everything works fine.

Thanks all for the help.

Ruby on Rails 3 Tutorial: Chapter 2 Section 2.2.1 A User Tour

I've tried rails learning with Windows 7 + Cygwin and it was a real pain in the ass. I strongly recommend you to run linux on the virtual machine or make a dual-boot.

invalid byte sequence error loadin page on Ruby on Rails

Add

# encoding: utf-8

To the top of whichever file is throwing the error

Encoding iso-8859-1 isn't working on rails 5

Removed all old js files from application. It started running.

Rails Error: \xE4 followed by l on UTF-8

OK, since you do not seem to understand the short explanation in comments, I will put this as an answer.

puts "\xE4".force_encoding('ISO-8859-1').encode('UTF-8')
#⇒ ä

That said, either one (or many) of your stylesheets, or one (or many) of your javascripts are stored in ISO-8859-1 encoding. Ruby tries to read everything in UTF-8 by default. You should find the file that causes problems, open it in any editor and save back in UTF-8 encoding.

You might also do the bulk update with smth like

Dir['*/**/*.js', '*/**/*.css'].each do |f|
File.write f, File.read(f).force_encoding('ISO-8859-1').encode('UTF-8')
end

Please aware that the bulk update might cause the opposite problem, if any of files contained valid utf-8.



Related Topics



Leave a reply



Submit