RE: [PHP] Insert Symbol into Mysql
does JavaScript use the proper way to encode strings as encodeURIComponent is, and for each sent key/value pair? Is MySQL table charset ut8_general_ci ? If not, do you convert sent UTF-8 charset into table charset? In few words we miss the way/library used to send data, the default PHP charset, the MySQL table charset, the way you store/retrieve data into MySQL, etc etc ... we can help but we need more info From: esam...@barc.gov.in To: php-general@lists.php.net Date: Wed, 16 Sep 2009 17:00:31 +0530 Subject: [PHP] Insert Symbol into Mysql I want to insert symbols like degree, plusminus, currency along with string into Mysql database. Front is HTML form with javascript. Server side scripts are written in PHP. Please help. Regards, Samrat Kar _ With Windows Live, you can organize, edit, and share your photos. http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx
Re: [PHP] Insert Symbol into Mysql
On Wed, 2009-09-16 at 17:00 +0530, Samrat Kar wrote: I want to insert symbols like degree, plusminus, currency along with string into Mysql database. Front is HTML form with javascript. Server side scripts are written in PHP. Please help. Regards, Samrat Kar Two ways to do this: 1. Insert the characters as their escaped HTML codes, e.g. #176; #177; #163; (for °, ± and £) 2. Set the DB to use a utf8 character set, and insert the characters directly as is, without escaping them Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Insert Symbol into Mysql
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 #176; 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: a...@ashleysheridan.co.uk Two ways to do this: 1. Insert the characters as their escaped HTML codes, e.g. #176; #177; #163; (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
RE: [PHP] Insert Symbol into Mysql
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 #176; 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: a...@ashleysheridan.co.uk Two ways to do this: 1. Insert the characters as their escaped HTML codes, e.g. #176; #177; #163; (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 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
Re: [PHP] Insert Symbol into Mysql
If he´s really using a any other charset instead of utf8 table, why not using utf8_decode and utf8_decode in his php files to solve this? Ashley Sheridan a...@ashleysheridan.co.uk escreveu na mensagem news:1253101315.2275.4.ca...@localhost... On Wed, 2009-09-16 at 17:00 +0530, Samrat Kar wrote: I want to insert symbols like degree, plusminus, currency along with string into Mysql database. Front is HTML form with javascript. Server side scripts are written in PHP. Please help. Regards, Samrat Kar Two ways to do this: 1. Insert the characters as their escaped HTML codes, e.g. #176; #177; #163; (for °, ± and £) 2. Set the DB to use a utf8 character set, and insert the characters directly as is, without escaping them Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Insert Symbol into Mysql
I don't recall him saying that a utf8 table was not an option or that he wasn't using one. I know 'cause he replied directly to me rather than this ML Also, try not to top post ;) I usually hate scroll 'till the end to find often a single row as reply ... I'll try though Thanks, Ash http://www.ashleysheridan.co.uk Thanks _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
RE: [PHP] Insert Symbol into Mysql
If he´s really using a any other charset instead of utf8 table, why not using utf8_decode and utf8_decode in his php files to solve this? let's say PHP could have a different charset than the one defined in that MySQL table so this is not a portable solution, specially if you do not perfectly know charset and problems. Regards _ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx
RE: [PHP] Insert Symbol into Mysql
On Wed, 2009-09-16 at 15:40 +0200, Andrea Giammarchi wrote: I don't recall him saying that a utf8 table was not an option or that he wasn't using one. I know 'cause he replied directly to me rather than this ML Also, try not to top post ;) I usually hate scroll 'till the end to find often a single row as reply ... I'll try though Thanks, Ash http://www.ashleysheridan.co.uk Thanks _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx Yeah, the rules say to snip out parts of the convo which aren't pertinent, but I know I don't exactly follow that one either! :-/ Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Insert Symbol into Mysql
Yeah, the rules say to snip out parts of the convo which aren't pertinent, but I know I don't exactly follow that one either! :-/ Thanks, Ash http://www.ashleysheridan.co.uk to be honest the problem is that I am in hotmail rather than gmail here, and this page is not clever as gmail one is, quotes/replies are quite annoying here. Thanks _ Share your memories online with anyone you want. http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1