Re: [Sass] How to let Sass permanently output UTF-8 CSS files on Windows.

3,654 views
Skip to first unread message

Nathan Weizenbaum

unread,
Oct 22, 2012, 5:04:11 PM10/22/12
to sass...@googlegroups.com
You should use the standard CSS feature for declaring the encoding of your files, @charset. Just put '@charset "utf-8";' at the beginning of every file that includes UTF-8 characters and Sass will know that those files are UTF-8 encoded.

On Mon, Oct 22, 2012 at 9:49 AM, Robertino <rober...@gmail.com> wrote:

Ref : Windows 7 Pro, Ruby 1.9.3, SASS 3.2.1

What's the trick to get "sass --watch" and "sass --force --update" to always output UTF-8 on Windows 7 ?

Some of the standard  _*.scss import files, which I use in all my projects, definitely have UTF-8 characters, for example all quotes from this pages : en.wikipedia.org/wiki/Quotation_mark_glyphs
And all my projects in the IDE have properties set as UTF-8 encoding with Unix line endings because that's 1-on-1 with their destination.
I also checked these properties on the files concerned, to make sure that the project settings were not overridden.

Right now I'm adding "-E UTF-8" to the 2 commands above. But several times I already forgot to add this switch and ended with weird characters in production.
Without this switch, Sass's Ruby scripts transcode the UTF-8 files to CP850 encoding, and then output a "CP850" encoded *.css file.

I also checked Ruby's external and internal encodings, and they were set to "CP850" and "null" respectively.
So I tried doing things the proper way by adding the "magic comment" (as the first 2 lines) to "sass.rb" and "exec.rb" to change the external encoding to UTF-8 and leave the internal at null, but that didn't do the trick for some reason.

#!/usr/bin/env ruby -w
# encoding: UTF-8

I'm looking for a more permanent resolution to output UTF-8 css files, so what's the trick?

--
You received this message because you are subscribed to the Google Groups "Sass" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sass-lang/-/bHJ9jQu0Lh4J.
To post to this group, send email to sass...@googlegroups.com.
To unsubscribe from this group, send email to sass-lang+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sass-lang?hl=en.

Robertino

unread,
Oct 22, 2012, 8:05:05 PM10/22/12
to sass...@googlegroups.com
That's already in the files. Forgot to mention that. And it starts exactly at position 1 of line 1.

Robertino

unread,
Oct 22, 2012, 8:16:06 PM10/22/12
to sass...@googlegroups.com
Uhm, actually while re-reading your response, does it matter if "UTF-8" is in caps or lower case ?

Robertino

unread,
Nov 1, 2012, 11:46:29 PM11/1/12
to sass...@googlegroups.com
I've just dumped sass.

Reasons :
a) This issue.
b) The fact that I always have to manually run "sass --force --update" after a change to my custom .scss files.
Just because "sass --watch" never detected any changes made to my own custom .scss file which I added as the last @import to the Inuit.CSS and Zurb Foundation's top/start .scss file.
But "sass --watch" did always detect changes made to the standard .scss files of Inuit.CSS and Zurb Foundation (read framework updates/upgrades). 
Weird. But it is at best described as annoying. (But enraging would better describe it.)

Because I'm the only one apparently experiencing this, it must be something with my box's setup. But I'm not willing to waste more time on these 2 issues.
One more last compilation to uncompressed CSS, dumping the 2 sass based frameworks for all future projects, and back to plain old CSS.

Ethan Lai

unread,
Mar 25, 2013, 10:27:15 AM3/25/13
to sass...@googlegroups.com
There is a gui for Sass, out of the box. The output default encoding is "uff-8", you can give it a try.
Get it at: http://koala-app.com/


在 2012年10月23日星期二UTC+8上午12时49分59秒,Robertino写道:
Reply all
Reply to author
Forward
0 new messages