Benches / Mail, Safari and messaging
Safari improperly renders Unicode block c…
apple Verified ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Take a look at this example page and let me know what
your browser shows:
http://farfalle.com/barexample.html
I'm programmatically creating a simple bar graph using Unicode characters in the U+2580 range and above. (There are reasons I'm doing it that way - trust me on that, ok?)
In every version of IE and Firefox I try, this looks beautiful.
In every version of Safari (I have Mac and iPhone), it looks pretty ugly - lots of gaps, and spacing issues galore.
I believe the Safari (WebKit) is wrong in this - not just because I trust the other browsers more, but because the Unicode characters should be identical widths, and Safari/Webkit isn't showing them that way.
Please let me know what you see, because I have limited access to Mac platforms (I'm using Safari 4.0.4 on 10.5.8 OS X). Thanks.
/ThatSeattleGuy/
15 replies
Sign in or join Beachball Help to reply.
- 0
Carolyn Samit ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
- 0
ThatSeattleGuy ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Yes, that's what I see under 10.5.x too. It's really messy.
I still suspect a deep WebKit rendering bug that's not OS or platform-specific.
Thanks.
- 0
- 0
Tom Gewecke ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
It does not work right for me on FireFox 3.5.7, OS X 10.6.2, same kind of distortion.
I suspect your html is not right for this, either pre for font-face not being read correctly. Why are you using ascii escapes instead of direct input?
PS Also messed up on Google Chrome.
- 0
ThatSeattleGuy ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Tom, thanks for another data point.
What do you mean by "direct input"? As far as I know there's no other way to produce Unicode block and line-draw characters within HTML, other than specifying them directly. These aren't "ascii escapes"; they are direct and standard coding for the Unicode character itself.
In other words, I don't know of any magically way of producing (for example) a Unicode full-block character other than directly specifying "█" or "&x2588;". Enlighten me if you know differently, though.
Message was edited by: That
SeattleGuy - 0
Tom Gewecke ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
PS I fixed your code so it works. You need to specify a font that will display this stuff correctly, e.g. Menlo in 10.6. I don't know about 10.5 or windows.
You can get the code via view source at this url.
- 0
- 0
ThatSeattleGuy ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Tom - your example is still badly formatted under my copy of Safari (4.0.4) on OS X 10.5.8. So the fix was specific to your system, unfortunately.
And I doubt that Menlo is going to make any Windows users happy. 🙂
But thanks for adding the Meta header - I thought of that and hoped it would make a difference - but obviously not. Back to square 1...
- 0
Tom Gewecke ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
What do you mean by "direct input"?
You go to Character Palette (Edit > Special Characters), find whatever you want in the code tables, and double click on it to make it appear in your text editor. Then save as UTF-8.
These aren't "ascii escapes"; they are direct and standard coding for the Unicode character itself.
The standard encoding for Unicode on the internet is UTF-8. The ampersand codes are a special way to represent Unicode when your software can only accept ascii input. But since virtually all software has been able to handle Unicode UTF-8 for a number of years now, that is what is normally used for web pages.
- 0
ThatSeattleGuy ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I doubt my C program is going to be able to select "special characters" from a menu, since it's running unattended on a server. 🙂
Perhaps you didn't get the original note (first post) - these graphs are being produced programmatically, so there's no "direct input" available. (Nor would it make sense - each graph contains hundreds of block characters, and I'm producing 25,000 graphs at a time).
Regardless, the same characters should render correctly when expressed as Unicode sequences.
- 0
Tom Gewecke ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
So the fix was specific to your system, unfortunately.
Try my url again (after doing Safari > Empty Cache) -- I changed the font to Courier New, which may help.
- 0
ThatSeattleGuy ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Tom - thanks! Marked that as "helpful", which it definitely was! The "style: font-family" tag was key. (I'd tried simply "font face="courier" earlier, which didn't work.)
I'm going to try on some other browser now, but if this works I don't really care that Safari renders the other pages differently than IE or Firefox - if it works for all of them that's good for me.
thanks /tsg/
- 0
Tom Gewecke ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Tom - thanks! Marked that as "helpful", which it definitely was! The "style: font-family" tag was key. (I'd tried simply "font face="courier" earlier, which didn't work.)
I don't think Courier will work, because that font does not contain the characters. It has to be Courier New. That change in the code makes your graph display correctly for me in Safari, Firefox, and Chrome.
- 0
Tom Gewecke ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
these graphs are being produced programmatically, so there's no "direct input" available. (Nor would it make sense - each graph contains hundreds of block characters, and I'm producing 25,000 graphs at a time).
Thanks for that explanation, I had indeed missed this point. I imagine that your program could probably directly produce the UTF-8 needed to replace the ascii, but it may not be worth the trouble figuring that out. The only advantage of using UTF-8 is that when someone views the underlying source with a text editor they see the same thing as you see with a browser and not just bunch of numbers.
- 0
ThatSeattleGuy ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Solved. Understood - courier is old and doesn't have the right characters. I was going by an older reference that said Courier is "safer" than Courier New since it's on more systems. But that doesn't help in this case. 🙂
Question - which of these is correct? (note subtle diff in quoting)
<font style="font-family: 'Courier New','courier',monospace"> or
<font style="font-family: Courier New,courier,monospace"> or
something else entirely?I'm just going by a web reference that says that *in stylesheets* the generic category (in this case 'monospace') can't be quoted. But I'm not sure that applies if just using the <font style=> tag.
Of course I probably should be doing ALL of this with an embedded stylesheet....another day. :}
