News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen's Blog:
UTF8, PHP and MySQL
March 19, 2009 @ 08:43:19

Rob Allen had a problem - he needed to get the "pound" (as in the British monetary unit) into his MySQL database. His database didn't seem to want to comply:

Everyone else probably already knows this stuff, but I hit an issue today to that took a while to sort out. Fortunately, some kind folks on IRC helped me, but as it's embarrassing to ask for help on the same issue twice, I'm writing down what I've learned! The problem: Get a £ character stored to MySQL, retrieved and then displayed without any weird characters in front of it using UTF8.

His solution? Make sure you're using UTF-8 everywhere, not just when trying to insert into the database - in the broser's headers (both going in and coming out) and in the MySQL database insert. He gives code examples for each including database examples for PDO and the Zend_Db component of the Zend Framework.

0 comments voice your opinion now!
utf8 mysql insert pound character example problem solution


blog comments powered by Disqus

Similar Posts

PHP & jQuery: Calendars

Marcus Bointon's Blog: Compiling wkhtmltopdf on Mac OS X 10.7 Lion

HowToForge.com: Installing Lighttpd With PHP5 And MySQL Support On OpenSUSE 11.1

IBM developerWorks: 30 game scripts you can write in PHP, Part 1: Creating 10 fundamental scripts

Leonid Mamchenkov's Blog: PHP regular expression to match English/Latin characters only


Community Events

Don't see your event here?
Let us know!


series api opinion extension laravel5 voicesoftheelephpant podcast community framework release library language laravel interview version introduction security unittest threedevsandamaybe symfony

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework