Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    235
    Thanks
    0
    Thanked 0 Times in 0 Posts

    converting special characters problem with ® and ™

    I have a problem with characters such as the ® reg mark it is making an rss feed invalid. I need to convert them to there code when i submit them to a MySQL database but I am not sure of the best way to do this.
    I have tried

    PHP Code:
    $text_art htmlspecialchars($_POST['text_art']); 
    But it does not work.

    Any pointers ?

    Crowds
    PHP magpie | And President Of The Marmalade Atkins Fan Club | Crowds Design

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Did you try htmlentities()?

  • #3
    Regular Coder
    Join Date
    May 2005
    Posts
    235
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Fumigator,
    Just tried it and it works for the reg marks but not the trade marks.
    Don't see why that would be ?


    Crowds
    PHP magpie | And President Of The Marmalade Atkins Fan Club | Crowds Design

  • #4
    Senior Coder koyama's Avatar
    Join Date
    Dec 2006
    Location
    Copenhagen, Denmark
    Posts
    1,246
    Thanks
    1
    Thanked 5 Times in 5 Posts
    For the trademark (TM) symbol, in XML you should use &\#8482; (decimal unicode code point) or &\#x2122; (hex). If you have used &\#153; (windows-1252 charset) then it will not work in XML as explained here.

    (Note the red backslashes should be removed. they were inserted to prevent the parsing.)

  • #5
    Regular Coder
    Join Date
    May 2005
    Posts
    235
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It being produced by ™
    In most cases the problem has arisen because the client has copy and pasted the text from another site (legitimately I should add )
    Oddly after following Fumigator's advice I noted that the tm code wasn't being replaced but I did not check the feed to see if it validates.. I have just checked and in fact it now does.

    Thanks again to you both.

    Crowds
    PHP magpie | And President Of The Marmalade Atkins Fan Club | Crowds Design


  •  

    Posting Permissions

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