Reputation: 621
This:
enum UnitOfMeasure: [ :g, :mg, :µg]
gives:
Syntax Error: invalid multibyte char (US-ASCII)
I hope I won't be forced to add a table just for this.
Upvotes: 0
Views: 1436
Reputation: 198
In my case I was running code directly in the console, I which I couldn't just add # encoding: UTF-8
, the solution under this situation is to set 2 environment variables:
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
Then you just only need to run rails c
, and you'll be able to use the characters you desire, in my case I tried to use Russian characters.
Upvotes: 3
Reputation: 211670
If you're not using a newer version of Ruby where UTF-8 encoding is the default you may need to add this to your file:
# encoding: UTF-8
If that doesn't fix it, be sure that your file is actually saved as UTF-8.
Upvotes: 2