XML Character encoding detection using PHP4
  • Hello :face-smile: ,
    I have a application that takes xml and throws out some formatted html.
    Now, I want to restrict users xml whose encoding is utf-16 due to
    various reasons. How to I check if the encoding of a document is utf-16
    using PHP 4. If not possible in PHP4 are there any unix “in built” utlities
    like iconv / xmllint that can be used from php to check the same.
    Also, I don’t want to rely on the “encoding=” that the user puts in his
    xml.

  • I'm not 100% up to scratch with utf (although I really should be), but out of curiosity (and a hunch), what happens if you just echo the utf-16 input straight back to the user? Is it displayed the same? (You might have to set some encoding header to get it right though)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook

Share Me

  • Please share this topic with your friends. Click any of the icons below:
  • stumbleupon
  • Twitter
  • facebook
  • myspace
  • technorati
  • reddit
  • fark
  • email