Jump to content

Recommended Posts

Dear friends,

 

I want to solve a problem kindly help me. I have table named as 'colors' it has color_reference, color_name_english and color_name_japanees.

 

I have a color name, it is also in japanese language. I want to compare this value with color table and want to pick the color_name_english and color_reference and use it.

 

Now the problem is that color_name_japanese in color table is in "full width katakana" and the value which I am getting and want to compare with color table is in "half width katakana". Both are in japaneese but due to its width the comparison doesn't gives the correct result.

 

Kindly help me, how will I compare both of these and how I will make resemblance with each other. I am using in php and in php i used the function "mb_convert_kana" but it also doesn't give accurate result.

 

Waiting for your urgent reply

Thank and regards

Link to comment
https://forums.phpfreaks.com/topic/202362-japanese-characters-issue/
Share on other sites

use this function to get the desired result

 

You are all late

 

 

function han_kaku_to_jen_kaku($str){

        $replace_of = array('ヴ','ガ','ギ','グ',

                            'ゲ','ゴ','ザ','ジ',

                            'ズ','ゼ','ゾ','ダ',

                            'ヂ','ヅ','デ','ド',

                            'バ','ビ','ブ','ベ',

                            'ボ','パ','ピ','プ','ペ','ポ');

        $replace_by = array('ヴ','ガ','ギ','グ',

                            'ゲ','ゴ','ザ','ジ',

                            'ズ','ゼ','ゾ','ダ',

                            'ヂ','ヅ','デ','ド',

                            'バ','ビ','ブ','ベ',

                            'ボ','パ','ピ','プ','ペ','ポ');

        $_result = str_replace($replace_of, $replace_by, $str);

       

        $replace_of = array('ア','イ','ウ','エ','オ',

                            'カ','キ','ク','ケ','コ',

                            'サ','シ','ス','セ','ソ',

                            'タ','チ','ツ','テ','ト',

                            'ナ','ニ','ヌ','ネ','ノ',

                            'ハ','ヒ','フ','ヘ','ホ',

                            'マ','ミ','ム','メ','モ',

                            'ヤ','ユ','ヨ','ラ','リ',

                            'ル','レ','ロ','ワ','ヲ',

                            'ン','ァ','ィ','ゥ','ェ',

                            'ォ','ヵ','ヶ','ャ','ュ',

                            'ョ','ッ','、','。','ー',

                            '「','」','゙','゚');

        $replace_by = array('ア','イ','ウ','エ','オ',

                            'カ','キ','ク','ケ','コ',

                            'サ','シ','ス','セ','ソ',

                            'タ','チ','ツ','テ','ト',

                            'ナ','ニ','ヌ','ネ','ノ',

                            'ハ','ヒ','フ','ヘ','ホ',

                            'マ','ミ','ム','メ','モ',

                            'ヤ','ユ','ヨ','ラ','リ',

                            'ル','レ','ロ','ワ','ヲ',

                            'ン','ァ','ィ','ゥ','ェ',

                            'ォ','ヶ','ヶ','ャ','ュ',

                            'ョ','ッ','、','。','ー',

                            '「','」','”','');       

        $_result = str_replace($replace_of, $replace_by, $_result);

        return $_result;

    }

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.