janlelis/unicode-display_width

Kanji characters get error

melborne opened this issue · 2 comments

Hi janlelis,
Great work!

Japanese use 3 types of charcters, Hiragana, Katakana, Kanji(Chinese Chars) and it works on Hiragana & Katakana.
But on Kanji, I got errors as follows;
irb(main):024:0> '一'.display_size
ArgumentError: ArgumentError
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/unicode-display_width-0.1.0/lib/unicode/display_width.rb:36:in line' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/unicode-display_width-0.1.0/lib/unicode/display_width.rb:42:incodepoint'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/unicode-display_width-0.1.0/lib/unicode/display_width.rb:65:in block in display_width' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/unicode-display_width-0.1.0/lib/unicode/display_width.rb:64:ineach'
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/unicode-display_width-0.1.0/lib/unicode/display_width.rb:64:in inject' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/unicode-display_width-0.1.0/lib/unicode/display_width.rb:64:indisplay_width'
from (irb):24
from /opt/local/bin/irb:12:in `

'

'一' represent 'One' in Kanji.
irb(main):025:0> '一'.unpack('U*')
=> [19968]
irb(main):026:0> Unicode::DisplayWidth.offsets[19968]
=> nil

Other Kanji chars might get same results.

Any way, you do great work.

melborne

Thanks for your issue.

It's now fixed (and refactored) with version 0.1.1 :)

It's now works on my env.
Thanks!