nythu has asked for the
wisdom of the Perl Monks concerning the following question:
i am new to cgi perl and now i am writing web site that use mysql database on japanese font.
I store the data in utf8 and the data in the mysql database table are as the following form. (this is just example)
( i added apostrophe(') codes here for appearing codes here, real data does not include ('))
and real readable data format is ..
ＣＡＲ (this is japanese full width alphanumeric character, not normal Ascii character)
My problem is that when i try to search this name by SQL statement , how can i change the user input data to this code array format(like "&'#20013;&'#30000;" ).(here also added apostrophe(') codes for appearing codes ) I have tried with some code. It was OK to convert one character.
I tried like that.
my $code = sprintf "%s", ord Encode::decode("sjis", $char);
this works for single character. So I tried for split string into character array and to convert each character. But it was not ok.I tried for splitting unicode string into character array using "split()" like that.
my @StrAry = split(//,$srcStr);
But it was only ok for normal string and cannot divide unicode string.
So, please let me know if there any good solution for that.
I want to write for the sql statement like "SELECT * FROM table1 WHERE item_name LIKE 'ネットワ%' " and which should result ネットワーク
I tried like this and it was oK "SELECT * FROM table1 WHERE item_name LIKE 'ネ%' " and which reults well.
But i cannot change user input string to related code array.
So, please help me if anyone know about unicode and mysql ,cgi perl.
Thnaks in advance