We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
headius
Learn more about funding links in repositories.
Report abuse
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
external_encoding = Encoding::SJIS html = open(file, "r:#{external_encoding}", invalid: :replace, undef: :replace ) do |f| require "nkf" external_encoding = NKF.guess(f.read) f.reopen(file, "r:#{external_encoding}") f.read end
external_encoding = Encoding::SJIS
html = open(file, "r:#{external_encoding}", invalid: :replace, undef: :replace ) do |f|
require "nkf"
external_encoding = NKF.guess(f.read)
f.reopen(file, "r:#{external_encoding}")
f.read
end
My file is a Japanese file.So NKF.guess's value is ISO-2022-JP. But Exception throws in f.reopen :
ArgumentError:ASCII incompatible encoding needs binmode when using NKF
jruby-9.1.8.0 Windows7_X64
The text was updated successfully, but these errors were encountered:
I di that: f.reopen(file, "rb:#{external_encoding}") It gone to be OK!
f.reopen(file, "rb:#{external_encoding}")
Sorry, something went wrong.
@zhangch-fnst still an issue than? if so could we get the file or a reproducable piece for NKF.guess(...)
file
NKF.guess(...)
No branches or pull requests
Here is my code:
external_encoding = Encoding::SJIS
html = open(file, "r:#{external_encoding}", invalid: :replace, undef: :replace ) do |f|
require "nkf"
external_encoding = NKF.guess(f.read)
f.reopen(file, "r:#{external_encoding}")
f.read
end
Exception
My file is a Japanese file.So NKF.guess's value is ISO-2022-JP.
But Exception throws in f.reopen :
Environment
jruby-9.1.8.0
Windows7_X64
The text was updated successfully, but these errors were encountered: