【问题标题】:How to make dired in Emacs use cp1251 under Windows?如何让 Emacs 中的 dired 在 Windows 下使用 cp1251?
【发布时间】:2012-12-13 18:59:52
【问题描述】:

我希望我的默认编码保持 utf-8。
但是在 Windows 下 - 我想使用 cp1251 查看我的一些文件名。 (因为 Windows 不支持 utf)

所有内容都显示为:\361\345\354

那么我该怎么做:

(setq coding-system-for-read 'cp1251)

只适用于dired模式而不适用于其他模式?

【问题讨论】:

    标签: emacs dired cp1251


    【解决方案1】:

    你可以试试这个:

    (add-hook 'dired-mode-hook
              (lambda ()
                (make-local-variable 'coding-system-for-read)
                (setq coding-system-for-read 'cp1251)))
    

    【讨论】:

    • 差点搞定了,没用过make-local-variable,只是对emacs的了解不够,谢谢
    • @Sergey 很高兴,您可以阅读相关内容:technical-dresese.blogspot.com/2012/12/…
    • 太棒了!多年来,我一直在遭受未解码的 utf-8 之苦。多亏了你,现在它已经修复了! :)
    猜你喜欢
    • 2012-04-02
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多