I try to use css-loader to load this file
body {
font-family: '寰蒋闆呴粦'; /* some chinese font name */
}
but get this
exports.push([module.id, "@charset 'UTF-8';\nbody {\n font-family: '\\5FAE\\8F6F\\96C5\\9ED1';\n}\n", ""]);
It looks like the font name is transformed into something else.
follow the way i found stringfyValues which will stringify the utf-8 character...
https://github.com/css-modules/css-selector-tokenizer/blob/master/lib/stringifyValues.js
what the declaration value is stringified for? Is there any way to use non ascii font name with css-loader?
font-family:Microsoft Yahei
Please support non-ascii characters in css-loader 馃憤
For me, this problem seems hard to solve at a first glance as unicode escaping done by postcss module.
Until proper solution applied, I would use interim solution by using hacky loader which unescape unicode.
https://github.com/swcho/font-family-unescape-loader
You can place "font-family-unescape-loader" right before "css-loader" then the loader will change font names of font-family config.
WIP
oh, two problems:
postcss-modules-local-by-default change 寰蒋闆呴粦 to \5FAE\8F6F\96C5\9ED1.css-loader on line https://github.com/webpack-contrib/css-loader/blob/master/lib/processCss.js#L129 also change 寰蒋闆呴粦 to \5FAE\8F6F\96C5\9ED1.First try to fix in css-loader, then in postcss-modules-local-by-default
/cc @michael-ciniawsky we can marked this as bug, i try to resolve this in near future, but very little time i have :sob:
Close in favor https://github.com/webpack-contrib/css-loader/issues/578
Most helpful comment
For me, this problem seems hard to solve at a first glance as unicode escaping done by postcss module.
Until proper solution applied, I would use interim solution by using hacky loader which unescape unicode.
https://github.com/swcho/font-family-unescape-loader
You can place "font-family-unescape-loader" right before "css-loader" then the loader will change font names of font-family config.