You are here: Re: String "’" translated to apostrophe. Why? « HTML « IT news, forums, messages
Re: String "’" translated to apostrophe. Why?

Posted by Richard on 07/19/07 14:48

On Jul 18, 8:23 am, Harlan Messinger
<hmessinger.removet...@comcast.net> wrote:
> Richard wrote:
> > This is re-posted fromhttp://groups.google.com/group/JavaScript-Information,
> > under the (poor) Subject "Script translated". It should have been
> > posted here in the first place.
>
> > I visitedhttp://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 &#x201a; or its decimal
> equivalent, &#8218;.

Hi Harlan,

Thank you for your thoughtful response. With the benefit of your
suggestions, I came to realize that the problem was my using a screen-
capture of web page. Following are details of my new understanding:

>> I particularly like the GUI the author created and want to emulate his
>> techniques. In particular, he used the (three character) string â?T
>> (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

Thank you very much for this link. I like it's explantion of various
encoding schemes.

When I first saw this â?T string on the subject web page, I saved
the
page's image as a text file and opened that file in a hex editor.
That's
how I discovered their hex representation E2 80 99.

Now that you mention Unicode encoding, I went back and looked at the
web
page's source. It shows that the author coded the entity &#8217;,
which
yielded that apostrophe. When I search for that entity, it asks "Are
you
looking for Unicode character U+2019: RIGHT SINGLE QUOTATION MARK?".
That
makes sense because 0x2019 == 8217. So, the author was trying to
present a
"high-class" apostrophe rather the common-place 0x27 ('). Finally,
now
that I look at that web page more carefully, I see that it *does*
present
the high-class apostrophe.

The last piece of the puzzle is that when I capture the textual
representation of the webpage with a "screen grabber" (SnagIt), it
somehow
comes up with that weird three character string.

The bottom line is that I violated the implicit boundaries between
various
tools and technologies. I apologize for that ;-)

Again, thank you for giving me some way to understand what was going
on
here, and especially for that helpful link.
--
Richard

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация