SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Html Decoding

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Sep 2004
    Location
    Denver
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Html Decoding

    Greetings, Is there a built-in function that decodes HTML? something that would convert (…) into (...) or do you know of any simple script that does that? I googled this topic and haven't found simple and straight forward way to do this. Thanks.

  2. #2
    SitePoint Zealot dawgbone's Avatar
    Join Date
    Dec 2003
    Location
    Brampton
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The html code is called … so just do a javascript string replace for it:

    Code JavaScript:
     
    var s = "To be continued …"
     
    document.write(s);
    document.write("<br><br>");
     
    var s2 = s.replace("&hellip;","...");
     
    document.write(s2);

    The document.write are just there to show you that it does in fact make a difference....

  3. #3
    SitePoint Addict
    Join Date
    Sep 2004
    Location
    Denver
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dawgbone, doing a simple replace is not going to do it for me, I need a way to decode HTML. also, the ... I have now look like this Ampersand numberSign 8230; and not like &hellip;
    Any thoughts?


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
  •