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

変換できない[解決済み] #395

Closed
U5376 opened this issue Jan 31, 2022 · 3 comments
Closed

変換できない[解決済み] #395

U5376 opened this issue Jan 31, 2022 · 3 comments

Comments

@U5376
Copy link

U5376 commented Jan 31, 2022

[2022-01-31 20:21:19] ERROR ArgumentError: invalid byte sequence in UTF-8\n\tC:/
Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.0/lib/narou_logger.rb:187:in `embe
d_timestamp'

[21:08:31] ID:12 リアデイルの大地にて【Web版】 の変換を開始
[21:08:34] 小説状態の調査結果を 調査ログ.txt に出力しました(エラー:3件、警告:0件、INFO:6件)
[21:08:34] 縦書用の変換が終了しました
[21:08:34] AozoraEpub3でEPUBに変換しています.
[21:08:35] C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/narou_logger.rb:187:in sub': invalid byte sequence in UTF-8 (ArgumentError) [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/narou_logger.rb:187:in embed_timestamp'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/narou_logger.rb:166:in append_log' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/web/streaminglogger.rb:78:in write'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/novelconverter.rb:194:in puts' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/novelconverter.rb:194:in txt_to_epub'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/novelconverter.rb:315:in convert_txt_to_ebook_file' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:300:in convert_txt_to_ebook_file'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/commandbase.rb:152:in call' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/commandbase.rb:152:in hook_call'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:252:in block in convert_novel_main' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:248:in each'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:248:in convert_novel_main' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:201:in block (2 levels) in convert_novels'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/mixin/locker.rb:26:in lock' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:200:in block in convert_novels'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:199:in each' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:199:in with_index'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:199:in convert_novels' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:159:in block in main'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:152:in each' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:152:in main'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:133:in execute' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/commandbase.rb:125:in execute!'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/commandbase.rb:134:in execute!' [21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/command/convert.rb:123:in block in execute!'
[21:08:35] from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/narou-3.8.1/lib/worker.rb:49:in `block (3 levels) in start'

@U5376
Copy link
Author

U5376 commented Jan 31, 2022

javaアップデートしたあと解決した

@U5376 U5376 changed the title 変換できない 変換できない[解決済み] Jan 31, 2022
@kubo
Copy link
Contributor

kubo commented Feb 6, 2022

[2022-01-31 20:21:19] ERROR ArgumentError: invalid byte sequence in UTF-8

このエラーはおそらくは java.exe が実行できなくて cmd.exe がシフトJISでエラーメッセージを出しているのに、(追記: Java 18 からパイプに対する標準出力がShift_JISになったのに)Helper::AsyncCommand.exec() の中で標準出力・標準エラーを以下のように UTF-8 決め打ちにしているせいだと思う。

narou/lib/helper.rb

Lines 422 to 423 in 1b07ae1

stdout.force_encoding(Encoding::UTF_8)
stderr.force_encoding(Encoding::UTF_8)

String#force_encoding(...) した後に String#valid_encoding? で本当に UTF-8 かどうかチェックして、UTF-8 じゃなかったら Encoding::Windows_31J (もしくは Encoding.find('locale'))に対して同様のことを行なってみるとか?

@ndxbn
Copy link

ndxbn commented Jun 18, 2022

@U5376 解決済みであれば、Close していただけませんか?

@U5376 U5376 closed this as completed Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants