NoraProgrmming
V2EX  ›  问与答

macOS 为什么打开某些 TXT 文件会乱码

  •  
  •   NoraProgrmming · Feb 21, 2024 · 2029 views
    This topic created in 986 days ago, the information mentioned may be changed or developed.
    macOS 新用户 还在摸索中

    最近发现 macOS 打开某些 TXT 文件会发生乱码(同一文件 win10 里打开不会)

    神奇的是我把这些乱码丢给 chatGPT 来解读 它居然能解读出一部分原文

    有没有好心老哥说说这是怎么回事?以及我怎么才能在 macOS 上解码读到原文呢?
    4 replies  •  2024-02-21 17:04:45 +08:00
    foxtalk
    foxtalk
    Feb 21, 2024❤️1
    1
    可能是编码方式是 GB2312 导致的,可以转成 utf8 格式的
    hguandl
    hguandl
    Feb 21, 2024
    2
    可以用 iconv 命令转换:

    iconv -f GBK -t UTF-8 file.txt > converted.txt
    NoraProgrmming
    NoraProgrmming
    OP
    Feb 21, 2024
    3
    @foxtalk
    @hguandl
    谢了兄弟 我去试试
    nutting
    nutting
    Feb 21, 2024❤️1
    4
    用 vscode 打开吧,乱码时候可以选 reopen with encoding
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1556 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:45 · PVG 01:45 · LAX 09:45 · JFK 12:45
    ♥ Do have faith in what you're doing.