habib009pk Posted May 20, 2010 Share Posted May 20, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/202362-japanese-characters-issue/ Share on other sites More sharing options...
habib009pk Posted May 20, 2010 Author Share Posted May 20, 2010 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; } Quote Link to comment https://forums.phpfreaks.com/topic/202362-japanese-characters-issue/#findComment-1061108 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.