11

I am using a unicode escape in my .sass file and I want to preserve it, but sass is creating a weird character in the output. How to solve this?

I'm using a Mac and Sass version 3.4.13.

mborkent@MacBook-Pro-van-Michiel /tmp $ cat new.sass
.icon-ok
  &:before
    content: "\e601"
mborkent@MacBook-Pro-van-Michiel /tmp $ sass new.sass new.css
mborkent@MacBook-Pro-van-Michiel /tmp $ cat new.css
@charset "UTF-8";
.icon-ok:before {
  content: ""; }

/*# sourceMappingURL=new.css.map */
Michiel Borkent
  • 34,228
  • 15
  • 86
  • 149
  • Also related: http://stackoverflow.com/questions/25677306/sass-3-4-1-escaping-a-270e-into-270e-which-breaks-a-font-icon – cimmanon May 24 '15 at 11:43

1 Answers1

28

It is known issue. There is a workaround, which can be found in the @tjbenton post on github:

@charset "UTF-8"

@function unicode($str)
  @return unquote("\"")+unquote(str-insert($str, "\\", 1))+unquote("\"")

.icon-ok
  &:before
    content: unicode("e601")

Output:

.icon-ok:before {
  content: "\e601";
}
sobolevn
  • 16,714
  • 6
  • 62
  • 60