Re: convert special characters.
Karl DeSaulniers <[email protected]>
| Newsgroups | gmane.comp.php.database |
|---|---|
| Message-ID | <[email protected]> |
On Aug 9, 2012, at 8:20 PM, Govinda wrote: >> 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 > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > That is a good point. I will try that and see. Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php