Jump to content

[SOLVED] help with character coding and htmlentities


c_shelswell

Recommended Posts

Hi I'm really struggling to get characters to display properly. I'm trying to make a site that can show multiple languages where a user has a test input i'm storing it in the DB using htmlentities then where it displays html_entity_decode. This seems to be working fine.

 

There's also parts where the data is just input to the DB using phpMyAdmin. If i have an e with an accent it won't display unless I use htmlentities. My charset is currently UTF-8 which displays the above fine but if i change it to allow the e accents to display it ruins the above.

 

Surely I don't have to add htmlentities to each place where strange characters might appear?

 

If you have any help I'm be really grateful. I'm running rapidly out of hair to pull out!

 

Oh the test string i'm using is: "test"///\\\'''deü©ΣДçگẫ_cur£$

 

Cheers

For anyone else that comes across this problem. It was a case of setting all collation in the database (the DB itself, tables and fields) to utf-8 then setting the web page to utf-8 and also adding this after connection to the database:

 

mysql_query("SET NAMES 'utf8';");

 

cheers

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.