Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

note 18266 added to function.utf8-decode

0 views
Skip to first unread message

jus...@visunet.ie

unread,
Jan 16, 2002, 11:49:47 AM1/16/02
to php-...@lists.php.net
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')");
#############################################
--
http://www.php.net/manual/en/function.utf8-decode.php
http://master.php.net/manage/user-notes.php?action=edit+18266
http://master.php.net/manage/user-notes.php?action=delete+18266
http://master.php.net/manage/user-notes.php?action=reject+18266

irc-...@php.net

unread,
Jan 16, 2002, 12:21:53 PM1/16/02
to php-...@lists.php.net
0 new messages