Closed U5376 closed 2 years ago
javaアップデートしたあと解決した
[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 決め打ちにしているせいだと思う。
String#force_encoding(...)
した後に String#valid_encoding?
で本当に UTF-8 かどうかチェックして、UTF-8 じゃなかったら Encoding::Windows_31J
(もしくは Encoding.find('locale')
)に対して同様のことを行なってみるとか?
@U5376 解決済みであれば、Close していただけませんか?
[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:inappend_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:inputs' [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:inconvert_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:incall' [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:inblock 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:inconvert_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:inlock' [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:ineach' [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:inconvert_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:ineach' [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:inexecute' [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:inexecute!' [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'