Jump to content

UTF8 problems


timhart

Recommended Posts

I have a problem with a system that I have taken over.  I would really appreciate one of you kind folks showing me where the problems are and possible solutions.

All of the data is read from the database and transfered as XML.

I have to allow multi language support so I have converted the mysql database to UTF-8.

When users copy and paste (especially from MS Word) text into the input fields it is converted using utf8_encode($str) and as an example a curly version of the apostrophe ends up being stored in the database as €Â™ (is this correct???).

After looking at a post on here I started using the htmlentites parameters in the file that creates the xml so this looks like this $xml .= htmlentities($str, ENT_QUOTES,'UTF-8');

After building the $xml string it gets put through the
$xml = mb_convert_encoding($xml,"UTF-8","auto");

Then the page that calls the xml (via curl) uses
$obs = simplexml_load_string($store);
and this is the line that errors.

Any ideas would be greatly appreciated as I am truly stuck

Thanks
Link to comment
https://forums.phpfreaks.com/topic/28317-utf8-problems/
Share on other sites

What are using for the database utf8_? Are you setting the database to return utf8 encoding? Just because you use utf8, does not mean the data is returned to your script in that state, you have to tell the database after you open the connection that utf8 encoding needs to be passed via the socket stream, if you don't it will never be returned correctly. Show me the code that shows how your connecting.


printf
Link to comment
https://forums.phpfreaks.com/topic/28317-utf8-problems/#findComment-129623
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.