encoding - How to convert from full-width to half-width Japanese characters in Java? -


i'm using class transliterator of icu project convert half-width full-width characters this:

transliterator transliterator = transliterator.getinstance("hiragana-katakana"); string converted = transliterator.transliterate("コンニチハ");  //half-width 

the result of converted is: コンニチハ (full-width)

but:

string converted = transliterator.transliterate("コンニチハ");  //full-width 

the result of converted still: コンニチハ (full-width)

my expectation コンニチハ. can me solve this?

thanks.

i found answer here. it's simple using different params below:

transliterator transliterator = transliterator.getinstance("halfwidth-fullwidth"); string converted = transliterator.transliterate("コンニチハ");  //half-width 

converted value: コンニチハ

transliterator transliterator = transliterator.getinstance("fullwidth-halfwidth"); string converted = transliterator.transliterate("コンニチハ");  //full-width 

converted value: コンニチハ


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -