Hi!

Thomas Morley <[email protected]> skribis:

> guile filename_名字.scm
> ;;; Stat of /home/hermann/Desktop/filename_??.scm failed:
> ;;; ERROR: In procedure stat: No such file or directory:
> "/home/hermann/Desktop/filename_\u540d\u5b57.scm"
> Backtrace:
> In ice-9/boot-9.scm:
>  160: 8 [catch #t #<catch-closure 55cae58fe4e0> ...]
> In unknown file:
>    ?: 7 [apply-smob/1 #<catch-closure 55cae58fe4e0>]
> In ice-9/boot-9.scm:
>   66: 6 [call-with-prompt prompt0 ...]
> In ice-9/eval.scm:
>  432: 5 [eval # #]
> In ice-9/boot-9.scm:
> 2404: 4 [save-module-excursion #<procedure 55cae59209c0 at
> ice-9/boot-9.scm:4051:3 ()>]
> 4058: 3 [#<procedure 55cae59209c0 at ice-9/boot-9.scm:4051:3 ()>]
> 1727: 2 [%start-stack load-stack ...]
> 1732: 1 [#<procedure 55cae5935db0 ()>]
> In unknown file:
>    ?: 0 [primitive-load "/home/hermann/Desktop/filename_\u540d\u5b57.scm"]
>
> ERROR: In procedure primitive-load:
> ERROR: In procedure open-file: No such file or directory:
> "/home/hermann/Desktop/filename_\u540d\u5b57.scm"

In C, argv is just an array of byte sequences, but in Guile,
(command-line) returns a list of strings, not a list of bytevectors.

Guile decodes its arguments according to the encoding of the current
locale.  So if you’re in a UTF-8 locale (say, zn_CH.utf8 or en_US.utf8),
Guile assumes its command-line arguments are UTF-8-encoded and decodes
them accordingly.

In the example above, it seems that the file name encoding was different
from the locale encoding, leading to this error.

HTH!

Ludo’.


Reply via email to