Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong encoding? #1235

Closed
geniuscodemonkey opened this issue May 22, 2015 · 6 comments
Closed

Wrong encoding? #1235

geniuscodemonkey opened this issue May 22, 2015 · 6 comments

Comments

@geniuscodemonkey
Copy link

Hi,

When I have a "content: '\e003';" in scss the file gets converted to "content: "";" instead of keeping the "\e003" ascii value.

I have a scss file of...
@import 'mixin';

a {
@include pseudoFontIcon('\e003');
}

with a mixin defined as ...

@mixin pseudoFontIcon($content) {
content: $content;
}

outputs a css of...

@charset "UTF-8";
a {
content: "";
}

but I would expect..

@charset "UTF-8";
a {
content: "\e003";
}

KR

MK

@asottile
Copy link
Member

Whichever editor you're reading the outputted source in is not respecting the UTF-8 encoding.

Apologies, the next bit is python (python2), but that's the easiest way to express the difference. Without knowing python, what you need to know is u'\u....' is a unicode literal containing a unicode escape (the equivalent in css is '\...'.

# The input character
>>> print(u'\ue003')

# The UTF-8 bytes printed
# This should appear the same as above
>>> print(u'\ue003'.encode('UTF-8'))

# The UTF-8 byte representation
>>> u'\ue003'.encode('UTF-8')
'\xee\x80\x83'
# The UTF-8 bytes misinterpreted as cp1252 (windows default encoding)
>>> print(u'\ue003'.encode('UTF-8').decode('cp1252'))
îƒ

@xzyfer
Copy link
Contributor

xzyfer commented May 27, 2015

I have noticed this aswell, however in my experience this doesn't affect the browsers's behaviour. Please confirm this actually causes an issue?

@xzyfer
Copy link
Contributor

xzyfer commented May 27, 2015

Duplicate of #1231.

@xzyfer xzyfer closed this as completed May 27, 2015
@geniuscodemonkey
Copy link
Author

Yeah it is an issue. Instead of seeing my custom font graphic, I see .
I have a workaround that solves my immediate issue; so I'm not too worried about this at the moment, and I will probably tell another internal development team to use the same workaround (although it will take extra effort). But it is definitely something that should be looked at is possible.

@asottile
Copy link
Member

Do you have a charset on your page such as:

        <meta charset="utf-8">

@Risord
Copy link

Risord commented Jul 23, 2015

What is status here?

I think this is little bit difrent thing than #1231 (but of course they maybe are related).

I don't think that is meaningless because output like "" is not meaningless on any encoding(?) Some testing (basicly same than on libsass-net topic):

.myClass {
content: "\f000";
}
-> "\f000" //Right

$my-variable: "\f000";
.myClass {
content: $my-variable;
}
-> ""

And on both way if using actual utf-8 character "" its also leads to "". I tested that if output would be like in topic #1231 so real utf character -> everything would work fine. In practice this problem cause problem when working with icons of font awesome library (http://fortawesome.github.io/Font-Awesome/).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants