note 18266 rejected from function.utf8-decode by irc-html
| From: | irc-html@php.net | Date: | Wed, 16 Jan 2002 17:21:53 +0000 |
| Subject: | note 18266 rejected from function.utf8-decode by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24940@lists.php.net to get a copy of this message | ||
Ok I couldn't work it out in php. So I used Perl instead.
You need to install the following modules in your
Perl distribution..
Unicode::Map
Unicode::String
At the top of your perl script put this..
#############################################
#!/usr/bin/perl
use Unicode::Map;
use Unicode::String qw(utf8 utf16);
$us = Unicode::String->new();
$map = Unicode::Map->new("ISO-8859-9");
#############################################
Then when you want to decode a string from
dmoz (utf8) into normal text do this..
#############################################
# Deal with unicode mapping
$us->utf8($my_string);
$my_new_string = $map->to8($us->utf16());
#############################################
Also..
If you want to put it into mySQL then you also need to install
the DBI:mysql module. And then use the folowing code at the top of the script..
#############################################
use DBI;
$dbh = DBI->connect('DBI:mysql:your_db_name', 'your_mysql_user_name',
'your_mysql_user_password');
#############################################
Then use this for the insert..
#############################################
# The insert statement
$dbh->do("INSERT INTO your_table VALUES
('$field1','$field2','$etc')");
#############################################