Convert Unicode value to ASCII value for use in Query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
iainfreestone
Forum Newbie
Posts: 4
Joined: Sun Sep 23, 2007 2:08 pm

Convert Unicode value to ASCII value for use in Query

Post by iainfreestone »

i have a function that returns a value in Unicode format. When I try and make a MySQL select statement with the Unicoce value it does not work.

So I need to change this Unicode value into a ASCII value that I can use in my database query.

Any help would be greatly appeciacted

Regards

Iain.
lnt
Forum Newbie
Posts: 12
Joined: Mon Sep 24, 2007 8:47 am

Post by lnt »

1. Create database in utf8_unicode_ci

2. Set Name UTF8
//open connection
//...
mysql_query('SET NAMES utf8;');

3. Set multibyte internal encoding
mb_internal_encoding("UTF-8");

Now you can work correctly with unicode string and database
Post Reply