Log in

View Full Version : Strange characters...



jamiller
04-01-2008, 08:38 PM
So I've built an program that takes some text and inserts that into a MySQL database with htmlentities and addslashes so it gets inserted no problem. However when it is read from the database with html_entity_decode a bunch of strange characters get displayed.

http://www.ja-miller.com/test/

Anybody have any ideas?

Nile
04-01-2008, 09:26 PM
Well, form what I see all you have are `?` replacing thinks like maybe some odd weird character('¿'). Or maybe its not odd its just a simple single quote('). But I think it depends on what kinda field you have in your collation[I think thats what its called].

I hope this helps.
Nile

jamiller
04-01-2008, 10:31 PM
Not completely sure what you were trying to say there... But, I changed the collation to several different types (from the default of latin1_swedish_ci) and no luck.

From looking at the source, something is happening with non breaking spaces ( ). However it makes absolutely no sense to me why this would be happening...

Thanks for trying tho!

boogyman
04-02-2008, 05:42 PM
use character encoding, and set it to UTF-8

jamiller
04-02-2008, 05:59 PM
Thanks for the response as always boogy! But how do I "use character encoding?" I did some googling and found out how to change it in php.ini. So I un-commented out the line, changed it from the default iso-something to UTF-8, and restarted the services but that didn't change anything.

Thanks

jamiller
04-02-2008, 06:01 PM
:P

Fixed it!! Explicitly telling the html_entity_decode function to expect UTF-8 worked perfectly!

Thanks again!