Unicode characters in JavaScript files

Discussion in 'Javascript' started by eggie5@gmail.com, Jan 3, 2007.

  1. Guest

    I have a custom object named #cdata-section, however I am unable to
    access this object and get a run time "Illegal Character" javascript
    error. my object looks like this:

    data.news.story.body.#cdata-section

    The pound sign is causing problems. How can I use this object in my
    javascript source? Right now I'm trying something like this to escape
    the pound sign:

    summaryNode.appendChild(document.createTextNode(data.news.story.body.\u0023cdata-section));

    however, that doesn't work, any ideas?
     
    , Jan 3, 2007
    #1
    1. Advertisements

  2. wrote:
    > I have a custom object named #cdata-section, however I am unable to
    > access this object and get a run time "Illegal Character" javascript
    > error. my object looks like this:
    >
    > data.news.story.body.#cdata-section
    >
    > The pound sign is causing problems. How can I use this object in my
    > javascript source? Right now I'm trying something like this to escape
    > the pound sign:
    >
    > summaryNode.appendChild(document.createTextNode(data.news.story.body.\u0023cdata-section));
    >
    > however, that doesn't work, any ideas?


    What about trying:

    data.news.story.body["#cdata-section"]


    Andrew Poulos
     
    Andrew Poulos, Jan 3, 2007
    #2
    1. Advertisements

  3. In comp.lang.javascript message <
    oglegroups.com>, Tue, 2 Jan 2007 19:23:37, ""
    <> posted:
    >I have a custom object named #cdata-section, however I am unable to
    >access this object and get a run time "Illegal Character" javascript
    >error. my object looks like this:
    >
    >data.news.story.body.#cdata-section
    >
    >The pound sign is causing problems. How can I use this object in my
    >javascript source?


    FAQ 4.25, FAQ 4.39, & cited Notes.

    It's a good idea to read the newsgroup and its FAQ. See below.

    --
    (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
    news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
    <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
    <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
     
    Dr J R Stockton, Jan 3, 2007
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Mark Bram
    Replies:
    0
    Views:
    4,365
    Robert Mark Bram
    Sep 28, 2003
  2. ygao

    unicode wrap unicode object?

    ygao, Apr 8, 2006, in forum: Python
    Replies:
    6
    Views:
    784
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Apr 8, 2006
  3. Gabriele *darkbard* Farina

    Unicode digit to unicode string

    Gabriele *darkbard* Farina, May 16, 2006, in forum: Python
    Replies:
    2
    Views:
    712
    Gabriele *darkbard* Farina
    May 16, 2006
  4. gabor
    Replies:
    13
    Views:
    829
    Leo Kislov
    Nov 18, 2006
  5. Jean-Paul Calderone
    Replies:
    23
    Views:
    950
    Leo Kislov
    Nov 21, 2006
  6. Laszlo Nagy
    Replies:
    6
    Views:
    946
  7. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    1,330
    Grzegorz ¦liwiñski
    Jan 19, 2011
  8. mark4asp
    Replies:
    14
    Views:
    327
    Thomas 'PointedEars' Lahn
    Jan 9, 2008
Loading...