Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentError: invalid encoding when using NKF #4033

Closed
xinqinglxl opened this issue Jul 27, 2016 · 2 comments
Closed

ArgumentError: invalid encoding when using NKF #4033

xinqinglxl opened this issue Jul 27, 2016 · 2 comments

Comments

@xinqinglxl
Copy link

Got an invalid encoding when deal file whose contents is Japanese.

eg. test.txt (The encoding is UTF-8 without BOM)

テスト#means test

Here is the code:

lines = NKF.nkf('-w', File.read('test.txt')).split(/\r?\n/).map{|line| line.chomp}

Then I got the exception

ArgumentError: invalid encoding
nkf at org/jruby/ext/nkf/RubyNKF.java:228
at test.rb:106

Environment

jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) Client VM 24.80-b11 on
1.7.0_80-b15 +jit [Windows 7-x86]

@k77ch7
Copy link
Contributor

k77ch7 commented Sep 26, 2016

@xinqinglxl the above script doesn't reproduce. Works for me.

My Environment

jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit Server VM 25.66-b17 on 1.8.0_66-b17 +jit [darwin-x86_64]

@headius
Copy link
Member

headius commented Sep 26, 2016

This was fixed for 9.1 in efae5ad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants