• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4223
  • Last Modified:

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 :-)
Renante Entera
Renante Entera
  • 3
1 Solution
Have a look here:

If you download the class mentioned there and look in the example file it should be pretty self-explanatory.
Renante EnteraAuthor 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... :-((

eNTRANCE2002 :-)
try using

$err = $converter->get_error();

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();
$html = $converter->convert($utf8);
echo $html;

>>>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.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now