NKF raises ArgumentError: invalid encoding with unmappable character
--------------------------------------------------------------------
Key: JRUBY-4644
URL: http://jira.codehaus.org/browse/JRUBY-4644
Project: JRuby
Issue Type: Bug
Environment: % uname -a
Darwin tkrmb.lan 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT
2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
% java -version
java version "1.6.0_03-p3"
Java(TM) SE Runtime Environment (build
1.6.0_03-p3-landonf_19_aug_2008_14_55-b00)
Java HotSpot(TM) Server VM (build 1.6.0_03-p3-landonf_19_aug_2008_14_55-b00,
mixed mode)
Reporter: sasaki takeru
Assignee: Thomas E Enebo
Whan converting UTF8 unmappable characters to SJIS with NKF,
jruby raises ArgumentError.
CRuby ignores it.
## cruby
tkrmb:~% irb
irb(main):001:0> p RUBY_DESCRIPTION; u = [0x2603].pack("U*"); begin
NKF.nkf("-Ws", u); rescue => e; p e.inspect end
"ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin8]"
=> ""
irb(main):002:0> exit
## 1.4.0 without patch
tkrmb:~/tmp/src_clones/jruby% jirb
irb(main):001:0> p JRUBY_VERSION; u = [0x2603].pack("U*"); begin NKF.nkf("-Ws",
u); rescue => e; p e.inspect end
"1.4.0"
"#<ArgumentError: invalid encoding>"
=> nil
irb(main):002:0> exit
## 1.5dev with patch
tkrmb:~/tmp/src_clones/jruby% ./bin/jruby ./bin/jirb
irb(main):001:0> p JRUBY_VERSION; u = [0x2603].pack("U*"); begin NKF.nkf("-Ws",
u); rescue => e; p e.inspect end
"1.5.0.dev"
=> ""
irb(main):002:0> exit
I write tiny patch.
http://github.com/takeru/jruby/commit/7750b7e0f6d94f0aa4e3ef6b949c9afac7853445
but I don't know it is enough.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email