Help? Spec Character Problems w/JAVASCRIPT TOOLTIP

C

Curious Angel

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
 
C

Curious Angel

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
 
M

McKirahan

Curious Angel said:
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/struct/global.html#idx-title
 
E

Eric Bohlman

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top