如何在Lisp(sbcl+;slime)中打开名称包含unicode代码的文件?
结果:如何在Lisp(sbcl+;slime)中打开名称包含unicode代码的文件?,unicode,utf-8,common-lisp,filenames,slime,Unicode,Utf 8,Common Lisp,Filenames,Slime,结果: (with-open-file (s "~/例子.txt" :external-format :utf-8) (print s)) 例如: 在Aquamacs 3.5和最新的slime&sbcl2.0.2中: iterm2中的sbcl可以做到这一点: Aquamacs本身也可以正确地打开和写入包含utf-8的文件名 我试图补充一点 NIL c-string encoding error: the character with code 20
(with-open-file (s "~/例子.txt"
:external-format :utf-8)
(print s))
例如:
在Aquamacs 3.5和最新的slime&sbcl2.0.2中:
iterm2中的sbcl可以做到这一点:
Aquamacs本身也可以正确地打开和写入包含utf-8的文件名
我试图补充一点
NIL c-string encoding error:
the character with code 20363 cannot be encoded.
[Condition of type SB-INT:C-STRING-ENCODING-ERROR]
在我的aquamacs配置文件中,但它不工作。
请帮忙
更新:
我终于找到了原因。
在Iterm2中,命令
(setq slime-net-coding-system 'utf-8-unix)
(set-language-environment "UTF-8")
给出此输出:
在从ui打开的Aquamacs中,在eshell中,它提供:
在我加上:
locale
对于我的Aquamacs配置,它可以工作!
感谢所有回答我问题的人!
下面是帮助我的链接
添加如下内容:
(setenv "LANG" "en_US.UTF-8")
到您的emacs配置。
解释在上面。操作系统?我无法复制,这在Linux x86_64上运行良好,您在
*功能*
列表中是否有:sb unicode?我在Mac10.15.3中使用sbcl 2.0.2+slime+aquamcs我对Common Lisp不熟悉,请告诉我如何在功能列表中启用:sb unicode?在支持unicode的终端中尝试ir,如果问题仍然存在,那么最好在SBCL邮件列表(或类似列表)上询问如何在macOS上使用Unicode路径名,以及macOS上的SBCL是否支持这些路径名。
(setenv "LANG" "en_US.UTF-8")