xml - PHP character encoding problems -
I need help with a character encoding problem that I want to sort once and for all. Here is an example of some content that I pull from XML feed, insert in my database and then drag
As you can not see, many special HTML characters are corrupted / broken
How can I stop this once and for all? How am I able to support all types of characters?
I have tried that I can get every piece of coding, sometimes it improves most but still others are corrupt.
/ P>
Use UTF-8 everywhere and everywhere!
This is (if you use mysql and php):
- For example, to make "utf8_general_ci" collation, all the tables in your database Set up.
- After establishing a database connection, run the following SQL query: "SET NAMES 'utf8'"
- Always make sure that your editor's settings are set to UTF-8 encoding
-
Tag the following meta in the section of your HTML documents:
& lt; Meta http-equiv = "content-type" content = "text / html; charset = utf-8" & gt;
and pair of bonus tips:
- When you use PHP
or:
You can use a simple server-side configuration file that takes care of all the encoding items. In this case all you have to do on the header and / or the meta tag or the php.ini file No need for amendments. Just add your desired character set encoding to the .htaccess file and put it in your www root. If you want to fiddle with character set string and want to use your php code for it - then the second story database match should be exactly correct.
Footnotes: The UTF-8 not encoding solution is not its a solution no matter what character set / encoding is being used by one As long as the environment used is being taken into consideration.
Comments
Post a Comment