Page 1 of 1

ut8 encoding issue

Posted: Wed Feb 11, 2009 11:00 pm
by condorchou
I am writing user inputs into a xml file. This file is then read in using the DOMdocument object.

How do I encode the following string:

"Billy’s &"

Please be aware that this ' is different from ’

ut8_encode encodes the funny apostrophe but not the ampersand. htmlentities encodes the ampersand but not the funny apostrophe.

Can someone help?

Re: ut8 encoding issue

Posted: Wed Feb 11, 2009 11:32 pm
by requinix
condorchou wrote:ut8_encode encodes the funny apostrophe but not the ampersand. htmlentities encodes the ampersand but not the funny apostrophe.
So... do both. htmlentities first, utf8_encoding second.

Re: ut8 encoding issue

Posted: Thu Feb 12, 2009 12:04 am
by condorchou
That was awesome. I thought I did this combination earlier today but the output was completely jibberish but trying it just now it worked. I still don't believe it. thanx.