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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -