By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,817 Members | 2,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,817 IT Pros & Developers. It's quick & easy.

Help? Spec Character Problems w/JAVASCRIPT TOOLTIP

P: n/a
Help? Spec Character Problems w/JAVASCRIPT TOOLTIP

Hi, I'm experiencing bizarre problems with quote marks that previously displayed
properly in a Javascript TOOLTIP I wrote a year ago . . . and now, inexplicably,
won't translate (?). The COPYRIGHT text was originally written using Typographers
Quotes (in the ALT-0145, ALT-0146, ALT-0147, and ALT-0148 family). For those who
don't know what I'm talking about, these are the more stylized "curling" quotes.
When I resurrected this script just this morning, the following happened:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
<script language="JavaScript"> <!--
var yumyum="COPYRIGHT © 2004 yada yada.\nThe yada yada’s yada, “YADA YADA,” is yada
yada yada.";

BECAME

<script language="JavaScript"> <!--
var yumyum="COPYRIGHT © 2004 yada yada.\nThe yada yada’s yada, “YADA
YADA,” is yada yada yada.";
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -

I've noodled around with a few ways of trying to fix this — including (sigh) using
just plain average quote marks — and _always_ I get these 82~~ codes showing up.
Even stranger, this never used to happen. The © symbol shows up fine btw, as does
everything else. Anyone want to attempt helping me with this? Thanks!

Angel
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <MP************************@news.intergate.com>, by*******@usa.net says...
Help? Spec Character Problems w/JAVASCRIPT TOOLTIP


Never mind . . . I located one of my older demo HTML files and scrutinized the
differences between them. I had a
<title>yak yak yak yak yak</title>
line between the <head> </head> tags in this latest version.

I dropped the <title> line to just BELOW the </head> line and all my lovely
typographers quotes are back in business ha ha.

Go figure. ;)

Angel
Jul 20 '05 #2

P: n/a
"Curious Angel" <by*******@usa.net> wrote in message
news:MP************************@news.intergate.com ...
In article <MP************************@news.intergate.com>, by*******@usa.net says...
Help? Spec Character Problems w/JAVASCRIPT TOOLTIP


Never mind . . . I located one of my older demo HTML files and scrutinized

the differences between them. I had a
<title>yak yak yak yak yak</title>
line between the <head> </head> tags in this latest version.

I dropped the <title> line to just BELOW the </head> line and all my lovely typographers quotes are back in business ha ha.

Go figure. ;)

Angel

However,

<title></title> belongs between <head> and </head> per W3C:
7.4.2 The TITLE element
<!-- The TITLE element is not considered part of the flow of text.
It should be displayed, for example as the page header or
window title. Exactly one title is required per document.
-->
<!ELEMENT TITLE - - (#PCDATA) -(%head.misc;) -- document title -->
<!ATTLIST TITLE %i18n>

Start tag: required, End tag: required

Attributes defined elsewhere

lang (language information), dir (text direction)
Every HTML document must have a TITLE element in the HEAD section.

Authors should use the TITLE element to identify the contents of a document.
Since users often consult documents out of context, authors should provide
context-rich titles. Thus, instead of a title such as "Introduction", which
doesn't provide much contextual background, authors should supply a title
such as "Introduction to Medieval Bee-Keeping" instead.

For reasons of accessibility, user agents must always make the content of
the TITLE element available to users (including TITLE elements that occur in
frames). The mechanism for doing so depends on the user agent (e.g., as a
caption, spoken).

Titles may contain character entities (for accented characters, special
characters, etc.), but may not contain other markup (including comments).
Here is a sample document title:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>A study of population dynamics</TITLE>
.... other head elements...
</HEAD>
<BODY>
.... document body...
</BODY>
</HTML>

http://www.w3.org/TR/REC-html40/stru...html#idx-title
Jul 20 '05 #3

P: n/a
Curious Angel <by*******@usa.net> wrote in
news:MP************************@news.intergate.com :
Help? Spec Character Problems w/JAVASCRIPT TOOLTIP

Hi, I'm experiencing bizarre problems with quote marks that previously
displayed properly in a Javascript TOOLTIP I wrote a year ago . . .
and now, inexplicably, won't translate (?). The COPYRIGHT text was
originally written using Typographers Quotes (in the ALT-0145,
ALT-0146, ALT-0147, and ALT-0148 family). For those who don't know
what I'm talking about, these are the more stylized "curling" quotes.
They're the wrong codes for them, "working" on only some systems.
When I resurrected this script just this morning, the following
happened: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
<script language="JavaScript"> <!--
var yumyum="COPYRIGHT © 2004 yada yada.\nThe yada yada’s yada, “YADA
YADA,” is yada yada yada.";

BECAME

<script language="JavaScript"> <!--
var yumyum="COPYRIGHT © 2004 yada yada.\nThe yada yada’s yada,
“YADA YADA,” is yada yada yada.";


Those are in fact the correct HTML character references for curly quotes in
Unicode. The problem is that scripts aren't parsed as HTML and as a result
the script is seeing the literal text of the character references instead
of the actual curly-quote characters. You need to replace them with "\u"
escapes: \u2019 for the right single quote, \u201c for the left double
quote, and \u201d for the right double quote.
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.