• 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 :-)
0
Renante Entera
Asked:
Renante Entera
  • 3
1 Solution
 
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 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... :-((


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

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