Weird characters in text
Posted: Wed Feb 17, 2010 12:15 am
Hi there,
I am rather new to PHP (to web programming actually), I am have a problem handling my text fields.
When I store a text field into mysql database and then retrieving them back, they are displaying weird characters like these

and

I am using htmlentities($field) before storing the data into mysql, and when I display the text with or without nl2br(html_entity_decode($field)), the characters are appearing that way.
I have copied those characters and pasted them into blogs like blogspot to look at the post and see what exactly those characters are, and realise that some of those characters are actually 'nothing', i.e. they are not expressed (simply not there).
I have tried changing between UTF-8 and ISO-8859-1 charsets but it seems they are not the solution to the problem (or maybe it had nothing to do with it.. I'm just trying everything..)
I have some thoughts that perhaps it may be the language of the user's computer/keyboard, but it is hard for me to test as I cannot get the users who had such problems input something again - my site is running live on the web and random people are coming in.
Does anyone have any advice?
I am rather new to PHP (to web programming actually), I am have a problem handling my text fields.
When I store a text field into mysql database and then retrieving them back, they are displaying weird characters like these

and

I am using htmlentities($field) before storing the data into mysql, and when I display the text with or without nl2br(html_entity_decode($field)), the characters are appearing that way.
I have copied those characters and pasted them into blogs like blogspot to look at the post and see what exactly those characters are, and realise that some of those characters are actually 'nothing', i.e. they are not expressed (simply not there).
I have tried changing between UTF-8 and ISO-8859-1 charsets but it seems they are not the solution to the problem (or maybe it had nothing to do with it.. I'm just trying everything..)
I have some thoughts that perhaps it may be the language of the user's computer/keyboard, but it is hard for me to test as I cannot get the users who had such problems input something again - my site is running live on the web and random people are coming in.
Does anyone have any advice?