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

非アスキー文字列が文字化けする #8

Open
Masa-Shin opened this issue May 24, 2022 · 0 comments · May be fixed by #9
Open

非アスキー文字列が文字化けする #8

Masa-Shin opened this issue May 24, 2022 · 0 comments · May be fixed by #9

Comments

@Masa-Shin
Copy link

Masa-Shin commented May 24, 2022

概要

文字列の中に全角文字があるとunicode code pointに変換される

Source

<script lang="ts">
export default Vue.extend({
  data() {
    return {
      japanese: 'ああああ',
    }
  },
})
</script>

Output

import { defineComponent, ref } from "@vue/composition-api";
export default defineComponent({
  setup(_props, ctx) {
    const japanese = ref("\u3042\u3042\u3042\u3042");
    return { japanese };
  },
});

再現方法

全角文字をinputに入れる

原因

ここprintFileで文字化けしていると思われました。

しかしencodingのためのオプション等はなく、他に使えそうなメソッドも見つかりませんでした。
printFile後にdecodingすれば一応解決しそうですが、その場合元から符号化されたデータがあった場合それも戻ってしまうという問題があります(めったにないとは思いますが)。

@Masa-Shin Masa-Shin changed the title マルチバイト文字列が文字化けする 非アスキー文字列が文字化けする May 24, 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
1 participant