Re: convert special characters.
| From: | Govinda | Date: | Fri, 10 Aug 2012 01:20:49 +0000 |
| Subject: | Re: convert special characters. | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-48404@lists.php.net to get a copy of this message | ||
> They are getting converted in those functions I posted.
> They display correctly when in the text field, but when inserted to the DB by that functions,
> they get converted.
> Then when I echo them out of the DB they are the converted chars.
> I think it may be the table or table cell, but I read somewhere on php.net that hemlentities
> doesn't always convert correctly.
> Hence my asking of this question.
notice that htmlentities() has several params... incl. one for the charset:
http://us.php.net/manual/en/function.htmlentities.php
But now that I re-read your OP, I am thinking, WHY are you saving the data entity-ized at all? My
understanding has always been to save the data just *as it is*.. and if you LATER need to entity-ize
it (for example: for display on a webpage), then do that at the time you pull the data out of the db
for display. Of course this would require your db/table/connection are all of a charset that can
handle the characters you are asking it to save into the db.
I have a UTF-8 db that saves content in dozens of languages... and it works fine.. and none of the
data has been messed with at all from what the language-specific user input.
-Govinda