Bug #2954

wrong result of nkf with --numchar-input

Added by nobu (Nobuyoshi Nakada) about 2 years ago. Updated about 1 year ago.

[ruby-dev:40607]
Status:Closed Start date:03/13/2010
Priority:Normal Due date:
Assignee:naruse (Yui NARUSE) % Done:

100%

Category:ext
Target version:2.0.0
ruby -v:1.9.2dev (2010-03-13 trunk 26898)

Description

Bug #2953のコードを1.9で実行すると空になります。

$ ./ruby bug-2953.rb | od -tx1z
0000000 22 22 0a 0a                                      >""..<
0000004

nkf_buf_t->ptrはnkf_charの配列ですが、nkf_buf_pop()はunsigned
charになってるために最下位バイト以外は捨てられてしまいます。

これをnkf_charを返すようにしても、"\xe2\xa0\xae\x9f"というおかし
な結果になります。std_getc()でnkf_buf_pop()とgetc()が同列になっ
ているあたりが問題のような気がします。

Related issues

related to Backport86 - Backport #2953: nkf segfaults with --numchar-input Closed 03/13/2010

Associated revisions

Revision 26935
Added by naruse (Yui NARUSE) about 2 years ago

* ext/nkf/nkf-utf8/nkf.c: import latest nkf. [master 9306cb0] this also fixes [ruby-dev:40607]

History

Updated by naruse (Yui NARUSE) about 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r26935.
Nobuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF