Question

I get this error when I run rake db:migrate *db/migrate//004_add_data_to_measurement_type_and_measurement_unit.rb:3: invalid multibyte char (US-ASCII) db/migrate//004_add_data_to_measurement_type_and_measurement_unit.rb:3: invalid multibyte char (US-ASCII) db/migrate//004_add_data_to_measurement_type_and_measurement_unit.rb:3: syntax error, unexpected $end, expecting '}' ...celeration' => [{:name =>'m/s²', :si => true, :conversion_f...*

Then I checked it using *$ ruby -wc db/migrate/004_add_data_to_measurement_type_and_measurement_unit.rb* and got the same error.

I was sure that I have all the right gems in place, so I tested by removing the superscript in the line, making it :name =>'m/s' from :name =>'m/s²'. This removed the error.

But problem is that I need the superscript and do not know how previous developer managed to run the db:migrate on this. Have you seen something similar?

Thanks

Was it helpful?

Solution

The problem is that the superscript is not ASCII.

The previous developer may have set something so that UTF-8 was always assumed, but you should be able to do it for this script specifically by adding the magic comment

# coding: utf-8

near the top of the script.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top