tags:

views:

114

answers:

2

when saving hebrew to a mysql database (utf-8) i am getting it converted to something like this:

ר×

editing content directly in the database works and it outputs on the page fine too.

sorry forgot to ask a question... what am i doing wrong!?

+2  A: 

Pure inserting into the database will definitely not put entities into your input. The conversion must take place somewhere else.

You should step through the whole path the data takes, and see whether there's not a htmlentities executed somewhere.

Pekka
+1 it does look exactly like an `htmlentities()` done without passing the charset in. Use `htmlentities($string, ENT_QUOTES, 'utf-8')`, or, much simpler, just use `htmlspecialchars` instead, since that doesn't try to molest the non-ASCII characters. It's almost always the better function.
bobince
yes it was a htmlentities() issue - thanks!
Josh
A: 

You will have to use the html_entity_decode function on your data while saving it to your DB. Somewhere in your code there's probably a call to htmlentities that's responsible for your conversions.

BTW: please make sure calling mysql_real_escape on your data just BEFORE inserting it into your DB (without your vulnarable like ... hell).

aefxx
The better answer is to fix whatever is calling `htmlentities` in the first place, rather than just encoding it to be unencoded.
friedo