RE: [PHP] Insert Symbol into Mysql
| From: | Andrea Giammarchi | Date: | Wed, 16 Sep 2009 12:47:39 +0000 |
| Subject: | RE: [PHP] Insert Symbol into Mysql | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298094@lists.php.net to get a copy of this message | ||
He has no utf-8 charset in the table, so the first point is valid and htmlentities is the function (
http://uk.php.net/manual/en/function.htmlentities.php
)
You need to remember that in this way you need to use htmlentities for *everything*, specially for
searches, otherwise ° against ° will be a "not found".
Alternative could be mb_string for charset manipulation but since the table is not UTF-8 you could
have lots of problems with other chars ... so you change the charset if this is a new project before
you gonna be in trouble for size and/or performances, or you convert each stored stirng via
htmlentities and you start right now to use htmlentities as default select/insert "parser"
(or you convert everything into utf-8 via mb_string and you truncate the table, change the charset,
refill it via converted values performed into another table)
Regards
> From: ash@ashleysheridan.co.uk
> Two ways to do this:
>
> 1. Insert the characters as their escaped HTML codes, e.g. °
> ± £ (for °, ± and £)
> 2. Set the DB to use a utf8 character set, and insert the
> characters directly as is, without escaping them
_________________________________________________________________
Share your memories online with anyone you want.
http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1