I am using the following css to set the text for a button that will remove a tag:
button.close:after {
content: '×';
}
This results in a good looking button like this:
But randomly the string ×
gets replaced by the string Ã-
. I first thought this could be related to encoding but if indeed it was the problem I think this wouldn't happen randomly. It happens at a low frequency and at this very moment it is not happening (will update the question with another print screen as soon as it happens again).
This css code comes from a .less
file that I am compiling and then minifying and then concatenating.
How can I make sure the string ×
will be shown all the time?
This typically) happens when you're not decoding the text in the right encoding format (probably UTF-8).
Â, â (a-circumflex) is a letter of the Inari Sami, Skolt Sami, Romanian, and Vietnamese alphabets. This letter also appears in French, Friulian, Frisian, Portuguese, Turkish, Walloon, and Welsh languages as a variant of the letter "a". It is included in some romanization systems for Persian, Russian, and Ukrainian.
It is a character encoding issue. Whom ever is sending the mail is using a character set that is not appropriate. View menu (Alt+V) > character encoding and select UTF-8 or unicode should see the correct display.
The multiplication character has the UTF-8 sequence 0xC3 0x97
. When that is decoded using the Windows-1252 character set instead it becomes ×
(A tilde, em dash).
So, the problem is indeed that the CSS is decoded as Windows-1252 instead of as UTF-8. The CSS is normally decoded the same way as the HTML document, so it seems that there is no character set specification netier in the page nor in the HTTP header. That forces the browser to guess what the encoding is. As the browser is making the guess using any available data (and the algorithm differs between browsers) the guess can be different depending on how much of the page and related files are in the cache already.
Specify the encoding for the page in the HTML head:
<meta charset="utf-8">
You can also specify the encoding specifically for the CSS file by adding this at the top, but that should only be needed when it differs from the page encoding:
@charset "utf-8";
Try using 'ISO' value for that sign - \00d7
Check here: https://css-tricks.com/snippets/html/glyphs/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With