SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to show british pound sign in an option menu using javascript?

    I am using javascript to print british prices in a select menu. If I use £ it prints exactly that in the select options but if I use then it shows a diamond with a question mark in the middle.

    How can I show just the like you can just by entering the $? I am using ISO-8859-1 for my character set.
    John Saunders

  2. #2
    SitePoint Guru Rob_D's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have a look at this thread

  3. #3
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use unicode '\u00A3'

  4. #4
    SitePoint Member bhutz's Avatar
    Join Date
    May 2004
    Location
    Bedford
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What should I do if I have made an AJAX request and return some XML, like

    <content>!"$%^</content>

    I can output the string in Firefox just fine but trying to do the same in IE simply shows !" instead of !"$%^...so obviously the pound sign is causing a problem...I am not too sure about how I can fix my problem I am having with IE. Does anyone have any idea on this one please?

  5. #5
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you alert the value successfully?

    If not, it might be misreading the xml value.

  6. #6
    SitePoint Member bhutz's Avatar
    Join Date
    May 2004
    Location
    Bedford
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face

    No unfortunately not...in the database the value is ''
    Then I use the PHP function htmlentities which converts this to &pound; so it transferred as well formed XML which meant I also had to add an entity reference in my XML to display &pound; as .

    This doesn't really make a difference though as the nodes that the javascript searches through is still shown as &pound;.

    I have found a work around but I really don't think it's the best idea

    In my PHP service I replace '&pound;' with '\u00A3' and display XML
    echo str_replace('&pound;','\u00A3',$retXML);

    Then in javascript I reverse things...I have no idea why this works
    oMessage.getElementsByTagName('formname')[0].firstChild.nodeValue.replace(/\\u00A3/, '&pound;');


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •