RE: [PHP] Insert Symbol into Mysql
| From: | Ashley Sheridan | Date: | Wed, 16 Sep 2009 12:55:11 +0000 |
| Subject: | RE: [PHP] Insert Symbol into Mysql | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298095@lists.php.net to get a copy of this message | ||
On Wed, 2009-09-16 at 14:47 +0200, Andrea Giammarchi wrote:
> 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Å(¤Î“!$M¦
> éc
I don't recall him saying that a utf8 table was not an option or that he
wasn't using one.
Also, try not to top post ;)
Thanks,
Ash
http://www.ashleysheridan.co.uk