Convert japanese character to unicode equivalent

Hi Experts!

I have created a function to import data from a CSV file.  In connection with this, I need to store the data in its unicode equivalent but I have no idea on how to do it.  For sample data, kindly visit this site : http://www.ex-web.biz/jp_uni.txt

Any help is greatly appreciated...


Thanks in advance!
eNTRANCE2002 :-)
LVL 14
Renante EnteraSenior PHP DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nicholassolutionsCommented:
Have a look here:
http://www.expertsrt.com/phpBB2/viewtopic.php?t=596#5662

If you download the class mentioned there and look in the example file it should be pretty self-explanatory.
0
Renante EnteraSenior PHP DeveloperAuthor Commented:
Hi nicholassolutions!

First of all, thanks for your immediately reply.  Right now, I'm creating a basic and simple code using the said class but I couldn't get it to work perfectly.  Kindly refer back to the site I provided for the code...  What's wrong with the code I've made???

I have already spend the whole day on resolving this issue but to no luck.  Huhuhu... :-((


Regards!
eNTRANCE2002 :-)
0
nicholassolutionsCommented:
try using

$err = $converter->get_error();
print_r($err);

after you try the conversion. It seems that your input text is not in fact valid UTF-8 (I would guess you copied only part of the entire character -- it would be multiple ASCII characters, and some might not print, so you can't just cut and paste them).

Try working directly on the data from your file, without cutting/pasting anything. The code you'd need is (assuming your UTF-8 Japanese text is in $utf8):

require './class_unicode_converter_toolkit.php';
$converter = new unicode_converter_toolkit();
$converter->set_conversion_type('UTF8_TO_HTML_UCS4');
$html = $converter->convert($utf8);
echo $html;

Matt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nicholassolutionsCommented:
>>>Try working directly on the data from your file
What I mean here is, import the data using your function, and convert it without looking at it. I have a feeling it will work when you do it directly.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.