保存org文件时报错。

org 文件里有中文,保存的时候提示:

These default coding systems were tried to encode text in the buffer ‘org-clock-save.el’: (utf-8-dos (44 . 4194262) (45 . 4194268) (46 . 4194251) (47 . 4194244)) However, each of them encountered characters it couldn’t encode: utf-8-dos cannot encode these:

Click on a character (or switch to this window by ‘M-x other-window’ and select the characters by RET) to jump to the place it appears, where ‘C-u C-x =’ will give information about it.

Select one of the safe coding systems listed below, or cancel the writing with C-g and edit the buffer to remove or modify the problematic characters, or specify any other coding system (and risk losing the problematic characters).

raw-text no-conversion

这个怎么整?

1 个赞

你的buffer的编码设置的是不是 utf-8-dos?看一下有问题的字符(spacemacs 下是 SPC h c

Coding system for saving this buffer: U – utf-8-dos (alias: mule-utf-8-dos)

Default coding system (for new files): U – utf-8 (alias: mule-utf-8)

Coding system for keyboard input: c – chinese-gbk-unix (alias: gbk-unix cp936-unix windows-936-unix)

Coding system for terminal output: U – utf-8 (alias: mule-utf-8)

Coding system for inter-client cut and paste: U – utf-16-le (alias of utf-16le-with-signature)

Defaults for subprocess I/O: decoding: U – utf-8-dos (alias: mule-utf-8-dos)

encoding: U – utf-8-unix (alias: mule-utf-8-unix)

Priority order for recognizing coding systems when reading files:

  1. utf-8 (alias: mule-utf-8)
  2. iso-2022-7bit
  3. iso-latin-1 (alias: iso-8859-1 latin-1)
  4. iso-2022-7bit-lock (alias: iso-2022-int-1)
  5. iso-2022-8bit-ss2
  6. emacs-mule
  7. raw-text
  8. chinese-big5 (alias: big5 cn-big5 cp950)
  9. chinese-iso-8bit (alias: cn-gb-2312 euc-china euc-cn cn-gb gb2312)
  10. iso-2022-jp (alias: junet)
  11. in-is13194-devanagari (alias: devanagari)
  12. utf-8-auto
  13. utf-8-with-signature
  14. utf-16
  15. utf-16be-with-signature (alias: utf-16-be)
  16. utf-16le-with-signature (alias: utf-16-le)
  17. utf-16be
  18. utf-16le
  19. japanese-shift-jis (alias: shift_jis sjis)
  20. undecided

Other coding systems cannot be distinguished automatically from these, and therefore cannot be recognized automatically with the present coding system priorities.

Particular coding systems specified for certain file names:

OPERATION TARGET PATTERN CODING SYSTEM(s)


File I/O “\.dz\’” (no-conversion . no-conversion) “\.txz\’” (no-conversion . no-conversion) “\.xz\’” (no-conversion . no-conversion) “\.lzma\’” (no-conversion . no-conversion) “\.lz\’” (no-conversion . no-conversion) “\.g?z\’” (no-conversion . no-conversion) “\.\(?:tgz\|svgz\|sifz\)\’” (no-conversion . no-conversion) “\.tbz2?\’” (no-conversion . no-conversion) “\.bz2\’” (no-conversion . no-conversion) “\.Z\’” (no-conversion . no-conversion) “\.elc\’” utf-8-emacs “\.el\’” prefer-utf-8 “\.utf\(-8\)?\’” utf-8 “\.xml\’” xml-find-file-coding-system “\(\`\|/\)loaddefs.el\’” (raw-text . raw-text-unix) “\.tar\’” (no-conversion . no-conversion) “\.po[tx]?\’\|\.po\.” po-find-file-coding-system “\.\(tex\|ltx\|dtx\|drv\)\’” latexenc-find-file-coding-system “” (undecided) Process I/O “[pP][lL][iI][nN][kK]” (undecided-dos . undecided-dos) “[cC][mM][dD][pP][rR][oO][xX][yY]” (undecided-dos . undecided-dos) Network I/O nothing specified

我的是windows系统

看看 org-clock-save.el 这个文件打开能正常显示内容(“周四”)么?

试试用 chinese-gbk 打开,再保存为 utf-8


不清楚你的 set-language-environment 是怎么设置的,看这两个设置得有点奇怪?

搞不懂了,我换个配置文件吧。。。

(set-language-environment 'Chinese-GBK)
(prefer-coding-system 'utf-8-unix)

我也是同样的问题,日期显示的是: \326\236 之类的,设置这俩句后 显示正常了

1 个赞

请问这个SPC h c运行什么函数?(我不是Spacemacs,没法直接查)看你描述很有用的感觉。谢谢

describe-char,我上面写的有误,spacemacs 上是 SPC h d c

1 个赞

解决了我的问题,谢谢!