Wrong encoding for partial

大城市里の小女人 提交于 2019-12-04 20:20:37

On my Windows 7 machine, it worked to add the following line to my project's config.rb

Encoding.default_external = 'utf-8'

Also found a great GUI for compass / less / JS compression: http://koala-app.com/

Maybe it is not a direct answer, but even if you can't make Compass/Sass interpret UTF as you want, you may simply try to use unicode escape:

p:before {
    content: "\2022";
}

Where 2022 is hexadecimal code for your symbol. To get this code I executed this in irb:

irb> "•"[0].ord.to_s(16)
=> "2022"

Probably not a good solution if you have a lot of unicode chars, but at least a workaround. For example, FontAwesome uses it in its stylesheets.

Apart from escaping the character (predictable, but tedious) as suggested by @NIA, there are two other ways around this:

  1. Add @charset "utf-8"; to the top of _partial.scss
  2. Save _partial.scss as "UTF-8 with BOM".

Judging by what I've read so far, this seems to be a generic Ruby/WIN issue with incorrect encoding detection/fallback when building strings read from files on disk.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!