Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #9830
| From | Dr J R Stockton <reply1152@merlyn.demon.co.uk> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: JavaScript's Character Escaping Functions |
| Date | 2011-12-31 20:41 +0000 |
| Organization | Home |
| Message-ID | <Aw7vFYWoN3$OFwoQ@invalid.uk.co.demon.merlyn.invalid> (permalink) |
| References | <nk4qf7ti2bbod0k5flbs0bbm880dpdvv35@4ax.com> |
In comp.lang.javascript message <nk4qf7ti2bbod0k5flbs0bbm880dpdvv35@4ax.
com>, Thu, 29 Dec 2011 17:30:08, Gene Wirchenko <genew@ocis.net> posted:
> There are a number of functions for escaping various characters
>and de-escaping them:
> Escape Function Unescape Function
> --------------- -----------------
> escape() unescape()
> encodeURI() decodeURI()
> encodeURIComponent() decodeURIComponent()
>There may be others that I am unaware of.
>
> What I am definitely unaware of is when to use them. I have not
>seen any material on that other than vague (to me) sentences. They
>seem to assume that people already know what they are doing with them.
>
> Between them and HTML's "&something;", I really could use a good
>grounding in the area.
>
> Pointers please?
ECMA 5.1 section 15.3 gives full detail for the URI ones. The document
should be findable via the FAQ, and downloadable at an acceptable cost.
You need it. Section B.2 explains the escapes.
I doubt whether you want any of them.
You probably want "Table 4 — String Single Character Escape Sequences"
in section 7.8.4.
You might also need section "7.8.5 Regular Expression Literals", and
section 15.10 if you don't know RegExps from other languages.
For the HTML, read Wikipedia "Character entity reference" and its links
including "List of XML and HTML character entity references". For
characters outside that range, see <http://en.wikipedia.org/wiki/List_of
_Unicode_characters> and the definitive <http://unicode.org/charts/chari
ndex.html>.
If you discover that any of those cannot be found by links from pages on
my Web site, RSVP - should be in the js- and www- pages.
If all else fails, read the manual.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
JavaScript's Character Escaping Functions Gene Wirchenko <genew@ocis.net> - 2011-12-29 17:30 -0800
Re: JavaScript's Character Escaping Functions Tim Streater <timstreater@greenbee.net> - 2011-12-30 10:33 +0000
Re: JavaScript's Character Escaping Functions Gene Wirchenko <genew@ocis.net> - 2011-12-30 11:45 -0800
Re: JavaScript's Character Escaping Functions "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-30 22:06 +0200
Re: JavaScript's Character Escaping Functions Tim Streater <timstreater@greenbee.net> - 2011-12-30 22:45 +0000
Re: JavaScript's Character Escaping Functions "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-12-30 12:03 -0800
Re: JavaScript's Character Escaping Functions Denis McMahon <denismfmcmahon@gmail.com> - 2011-12-31 10:05 +0000
Re: JavaScript's Character Escaping Functions Gene Wirchenko <genew@ocis.net> - 2011-12-31 23:41 -0800
Re: JavaScript's Character Escaping Functions Dr J R Stockton <reply1152@merlyn.demon.co.uk> - 2012-01-02 19:10 +0000
Re: JavaScript's Character Escaping Functions Dr J R Stockton <reply1152@merlyn.demon.co.uk> - 2011-12-31 20:41 +0000
csiph-web