Re: Encoding/characterset/font family confusion
- From: Erwin Moller <since_humans_read_this_I_am_spammed_too_much@xxxxxxxxxxxxxxxx>
- Date: Fri, 30 Mar 2007 14:48:27 +0200
Toby A Inkster wrote:
Hi Toby,
Erwin Moller wrote:
A few day ago I discovered that the euro-sign is not defined in all
fontfamilies.
Browsers are *supposed* to switch fonts when they encounter a character
that does not exist in the current font. Unfortunately, Internet Explorer
is famously bad at this.
Yes, the 'browser' in question was IE6.
Changing fontfamily to Arial helped, but from a designers point of view it
would have been nicer to have the same font all over the page.
They cannot produce the right sign no matter if I use € or the
hexadecimal equivalent.
Yep -- it's not a problem with the way you've specified the character,
just a problem that the browser is trying to display it using a font that
doesn't contain that character.
After a little research I found I could put font-tags around the
euro-sign with another font-family (Arial in this case) to get the Euro
sign.
If you care about the symbol being rendered correctly in legacy browsers,
then this is the best solution. Either change the fonts of your whole
page, or use a little PHP+HTML+CSS:
It tried to switch to Arial, but my designer doesn't let me change the font
for the site.
These people are so strict!
I stopped asking what is wrong with monospaced fonts, such questions are
dangerous for my wellbeing. ;-)
$str = str_replace('€',
'<acronym class="e" title="euro">€</acronym>',
$str);
With CSS:
acronym.e { border-bottom:none; font-family: "Arial"; }
If you use output buffering, then you should be able to do this with
minimal code changes.
I'm actually doing something fairly similar on a current project, but with
ampersands instead of euro-signs. I wanted them all rendered in a
particular font which has an especially nice ampersand, but didn't want
the rest of the page to appear in that font.
Also, take a look at Jukka's page on the euro sign:
http://www.cs.tut.fi/~jkorpela/html/euro.html
Found that page earlier in my quest for the euro.
Thanks for your comment.
Regards,
Erwin Moller
As far as character sets are concerned, do not worry too much. HTML
documents effectively have two character sets: the one they're transmitted
in and the one they're translated into by the browser. The one they're
translated into is always Unicode, so always includes the euro symbol. So
you just need to worry about the one they're transmitted in -- you've
chosen ISO-8859-1, which does not include the euro symbol, but all that
means is that you need to use an entity instead -- you can't just type in
a raw ?.
.
- References:
- Encoding/characterset/font family confusion
- From: Erwin Moller
- Re: Encoding/characterset/font family confusion
- From: Toby A Inkster
- Encoding/characterset/font family confusion
- Prev by Date: Re: Updating the SQL key value
- Next by Date: Re: PHP code editor
- Previous by thread: Re: Encoding/characterset/font family confusion
- Next by thread: Re: Encoding/characterset/font family confusion
- Index(es):
Relevant Pages
|