Rails 3 invalid multibyte char (US-ASCII)

前端 未结 5 770
我寻月下人不归
我寻月下人不归 2020-12-02 11:04

I found a similar post here but I can\'t solve the problem anyway.

I got this

/home/fra/siti/Pensiero/db/seeds.rb:32: invalid multibyte char (US-ASCI         


        
相关标签:
5条回答
  • 2020-12-02 11:07

    Instead of adding # coding: UTF-8 try to add # encoding: UTF-8 on the first line of the file.

    It worked for me. I found the information here : http://groups.google.com/group/sinatrarb/browse_thread/thread/f92529bf0cf62015

    0 讨论(0)
  • 2020-12-02 11:13

    Taken from http://devsolvd.com/questions/rails-3-invalid-multibyte-char-us-ascii

    gem 'pdf-writer', :git => 'git://github.com/metaskills/pdf-writer.git'
    

    This was useful for me

    0 讨论(0)
  • 2020-12-02 11:18

    I changed the line:

    gem 'pdf-writer', :git => 'git://github.com/metaskills/pdf-writer.git'
    

    and that works for me.

    0 讨论(0)
  • 2020-12-02 11:21

    Just add the following line as the first line in the file:

    # -*- coding: utf-8 -*-
    

    and it will work.

    0 讨论(0)
  • 2020-12-02 11:24

    Add a magic comment in the script where you use non-ascii chars? It should go on top of the script.

    # encoding: utf-8
    

    It worked for me like charm.

    Or if you want to make the project wide, you have an option of magic-encoding gem

    0 讨论(0)
提交回复
热议问题