The ruby environment is used for sass file compilation. Interface-based koala tools and command line modes cannot be used, which is really annoying.
It is easy to see that Chinese comments cannot be compiled or garbled, and the solution after several days is finally solved.
The odd thing about this problem is that there is no problem in the XP environment, but it only appears in the Windows 7 environment.
The following error occurs during sass Compilation:
Syntax error: Invalid GBK character "\xE5" on line 8 of E:\work\sass\sass\_big_box.scss from line 16 of E:\work\sass\sass\main.scss Use --trace for backtrace.
Or
Syntax error: Invalid GBK character "\xE5" on line 2 of E:\work\sass\sass\main.scss Use --trace for backtrace.
Solution:
1. Koala visual compilation tool,
Find the engine. RB file under the sass-3.3.7 module in the installation directory, for example, the following path:
C: \ Program Files (x86) \ koala \ rubygems \ gems \ sass-3.3.7 \ Lib \ sass
Add a line of code to the engine. RB file.
Encoding.default_external = Encoding.find(‘utf-8‘)
Put it after all require XXXX.
2. Similarly, the command line tool
Find the ruby installation directory, which also contains the sass module, as shown in the following path:
C: \ Ruby \ Lib \ Ruby \ gems \ 1.9.1 \ gems \ sass-3.3.14 \ Lib \ sass
In this file, add a line of code (same method 1) to engine. RB)
Encoding.default_external = Encoding.find(‘utf-8‘)
Put it after all require XXXX.
Thanks https://github.com/imathis/octopress/issues/232Mattn provides a solution, which is very suitable here.