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

Posted by Jukka K. Korpela on 07/18/07 14:47

Scripsit Richard:

> http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html,

The page declares UTF-8 encoding (in a meta tag only - not really ideal, but
it works), though it seems to use mostly just Ascii characters, representing
other characters using character references like ’. Nothing wrong with
that really, but the author is not making the best possible use of UTF-8.

> I particularly like the GUI the author created and want to emulate his
> techniques.

What GUI? I see no Graphic User Interface there. Just a web page. If you
view it using a graphic browser, then you are using a GUI, but that's a
different issue.

> 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).

What? Where? I don't see anything like that on the page.

> However, IE7 leaves it untranslated.

You're enigmatic.

> I presume the author coded the apostrophe this way was for
> internationalization.

The page has apostrophes written as ’, which is a correct reference,
and modern browsers render it well. They don't map it to ASCII apostrophe,
except perhaps if they need to work with an ASCII-only rendering situation.

> But I don't see why this works in Firefox and
> HTML-Kit.

I don't see what you mean by "this".

> Can anyone explain why the following works in those two
> browsers?

(HTML-Kit is an authoring tool, not a browser.)

> <p>If you’re new to metaprogramming in Ruby</p>

Well it doesn't. The string ’ is rendered literally, as a mess of
characters. Maybe the actual file you used for testing contains something
completely different, though. (As usual, posting a URL...)

You have some confusion here. You have probably played with a program that
converts character references to UTF-8 encoded characters and later you have
interpreted the octets of the UTF-8 representation according to theWindows
Latin 1 (windows-1252) encoding.

It's easy to get confused with character encodings, and difficult to help
people out from a confusion. It's probably best to stop here and start
afresh. What do you really want? To use a punctuation apostrophe (’) on a
web page? Then write &#8217;. Or &rsquo;, if that's easier to remember.
There are other ways too, but these methods work independently of character
encoding and don't make you confused and don't require any particular editor
or UTF-8 support in your authoring software.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 

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

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