回答編集履歴
1
docs.rsへのリンクを追加
test
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
1
|
+
[SHIFT_JIS.decode](https://docs.rs/encoding_rs/latest/encoding_rs/struct.Encoding.html#method.decode)は(`Cow<'a, str>`が返ってくることから分かるように)「Shift-JISをUTF-8に変換する」関数です。従って、今やりたいこととは逆になります。
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
代わりに、
|
5
|
+
代わりに、[SHIFT_JIS.encode](https://docs.rs/encoding_rs/latest/encoding_rs/struct.Encoding.html#method.encode)に`buf`を渡してやれば「UTF-8からShift-JISへの変換」を行えるはずです。
|