Have you tried adding a magic comment in the script where you use non-ASCII chars? It should go on top of the script.
#!/bin/env ruby
# encoding: utf-8
It worked for me like a charm.
If you want to add magic comments on all the source files of a project easily, you can use the magic_encoding
gem
sudo gem install magic_encoding
then just call magic_encoding
in the terminal from the root of your app.
I just want to add my solution:
I use german umlauts like ö, ü, ä and got the same error.
@Jarek Zmudzinski just told you how it works, but here is mine:
Add this code to the top of your Controller: # encoding: UTF-8
(for example to use flash message with umlauts)
example of my Controller:
# encoding: UTF-8
class UserController < ApplicationController
Now you can use ö, ä ,ü, ß, "", etc.
That worked for me:
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With