Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8003

Re: basic Q on enclosing curly quotation/quot characters into strings

From "Jukka K. Korpela" <jkorpela@cs.tut.fi>
Newsgroups comp.lang.javascript
Subject Re: basic Q on enclosing curly quotation/quot characters into strings
Date 2011-11-04 22:05 +0200
Organization A noiseless patient Spider
Message-ID <j91gj2$f40$1@dont-email.me> (permalink)
References <3ce3cfc5-e4fb-45b9-8e6f-328ee1f388e7@m19g2000vbm.googlegroups.com>

Show all headers | View raw


11/4/2011 9:41 PM, Tim wrote:

> I need to change the "does" to "doesn't" where the single quote needs
> to be the proper curly single quote, because the font used to display
> this is a nice serif font.

A better reason is that the curly quotes are proper punctuation. But the 
use of punctuation should be consistent; use the same punctuation style 
in JavaScript-generated texts as in static content.

>  But the following change,  using the
> "decimal numeric character reference" for right single quote
> &#8217;     does not work:
>
>     labels[0] = "This doesn&#8217;t work for the typical case.";

It works in XHTML, but in classic HTML, no character references are 
recognized in <script> element content. And of course it does not work 
in an external JavaScript file.

You can use the JavaScript construct for including a character in a 
string literal: \u followed by exactly four hexadecimal digits. In this 
example,

"This doesn\u2019t work for the typical case."

Alternatively, you can enter the curly single quote as such, as a 
character, provided that the document's character encoding makes that 
possible (e.g., windows-1252 or utf-8).

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

basic Q on enclosing curly quotation/quot characters into strings Tim <timothygill07040@gmail.com> - 2011-11-04 12:41 -0700
  Re: basic Q on enclosing curly quotation/quot characters into strings "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-11-04 22:05 +0200
    Re: basic Q on enclosing curly quotation/quot characters into strings Timothy Gill <setsee@gmail.com> - 2011-11-04 13:42 -0700
      Re: basic Q on enclosing curly quotation/quot characters into strings Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-04 21:40 +0000
      Re: basic Q on enclosing curly quotation/quot characters into strings "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-11-04 23:50 +0200

csiph-web