2023-10-05から1日間の記事一覧

【Rust】Shift-JIS ファイルを UTF-8 へ変換

encoding_rs クレートを利用。 バイトバッファ経由での処理となるが、Shift-JISは1〜2バイト、UTF-8は1〜4バイトで、変換後のバイト数が読めないので意外と面倒。 use std::process; use std::error::Error; use std::io::Write; use std::io::Read; use std…