|
Posted by Harlan Messinger on 07/18/07 12:23
Richard wrote:
> This is re-posted from http://groups.google.com/group/JavaScript-Information,
> under the (poor) Subject "Script translated". It should have been
> posted here in the first place.
>
> I visited http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html,
> which provides a neat tutorial about metaclasses in Ruby programming.
>
> I particularly like the GUI the author created and want to emulate his
> techniques. In particular, he used the (three character) string ’
> (hex E2 80 99) which translated in ' (ASCII apostrophe) in both
> Firefox 2 and HTML-Kit HTML-Kit Version 1.0 (Build 292). However, IE7
> leaves it untranslated.
It isn't an ASCII apostrophe. It's Unicode U+201A, "SINGLE LOW-9
QUOTATION MARK".
http://www.fileformat.info/info/unicode/char/201a/index.htm
In my Firefox it looks like an apostrophe, but it shouldn't. If you want
an ASCII apostrophe, type an ASCII apostrophe. Guaranteed to work
regardless of the encoding.
>
> I presume the author coded the apostrophe this way was for
> internationalization. But I don't see why this works in Firefox and
> HTML-Kit. Can anyone explain why the following works in those two
> browsers?
>
> <?xml version="1.0" encoding="utf-8"?>
[snip]
If the file is stored locally as ISO-8859-1, then ’ are stored as E2
80 99. If these are the bytes that are sent to the web client, but the
client is told that the content is encoded as UTF-8, then it will treat
these bytes as such. In UTF-8, U+201A is encoded as E2 80 99. In any
event, there isn't any reason to do this. If this special character is
what you want, just use the hex character code ‚ or its decimal
equivalent, ‚.
Navigation:
[Reply to this message]
|