When saving Japanese/Chinese content to R2 through Worker, garbled characters appear

There will be the following garbled characters
Access https://test-r2.cfm.moe/1685369836787.txt to view.

this is demo
Is this issue caused by my storage method?

export default {
  async fetch(request, env, ctx) {
    const { pathname } = new URL(request.url);

    if (pathname === "/test") {
      const content = "こんにちは,你好,Hello";
      const id = Date.now();

      const arrayBuffer = new TextEncoder().encode(
      console.log(new TextDecoder().decode(new Uint8Array(arrayBuffer)));
      await env.R2.put(`${id}.txt`, arrayBuffer);

      return new Response(JSON.stringify({
        code: 200,
        url: `https://test-r2.cfm.moe/${id}.txt`,

    return new Response(null, { status: 404 });

I solved the problem by modifying it.

await env.R2.put(`${id}.txt`, "こんにちは,你好,Hello", {
  httpMetadata: {
    contentType: "application/json; charset=utf-8"