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
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts

    Exclamation changing non utf8 characters to utf8

    Hi all,

    i am pulling data from a xml file(product feed) and some of the info is displaying as.

    1/ white box instead of a pound sign
    2/ 's instead of '

    how do i make the data display properly?

    ive tried the following, which got rid of some of the lt; rt; problems but im not sure how to solve the above
    PHP Code:
                    $desc html_entity_decode($item->desc); 
    any ideas
    cheers
    Luke

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    i am pulling data from a xml file(product feed) and some of the info is displaying as.
    Are they in the correct utf format inside the xml file?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    Hi mate,

    no the xml file contains incorrect characters e.g
    Code:
    If you missed the selection for the last Winter Olympics, now's your chance to practise in time for the next one
    but at he top of the file it says
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    cheers

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Why do you need to decode it then? Browser outputs
    [...]Winter Olympics, now's your chance[...]
    when we simply print that line as such.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    when i print out the info i get the html code instead of the ' when viewing in the browser?

    i decoded it because i was getting stuff like lt; displayed and other html tags but this removed them, but i still get some html code appear.

    here is one of my pages which i am having trouble displaying the xml contents.


  •  

    Posting Permissions

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