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.
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.
Hector Acosta
On
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.
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:
If that doesn't fix it, be sure that your file is actually saved as UTF-8.