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. Advertising

  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. Advertising

  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. Advertising

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. Laszlo Nagy
    Replies:
    6
    Views:
    625
  2. Terry Reedy
    Replies:
    0
    Views:
    514
    Terry Reedy
    Jul 1, 2008
  3. M.-A. Lemburg
    Replies:
    0
    Views:
    896
    M.-A. Lemburg
    Jul 2, 2008
  4. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    968
    Grzegorz ¦liwiñski
    Jan 19, 2011
  5. mark4asp
    Replies:
    14
    Views:
    200
    Thomas 'PointedEars' Lahn
    Jan 9, 2008
Loading...

Share This Page