Hey Dave! David Kastrup <d...@gnu.org> skribis:
> l...@gnu.org (Ludovic Courtès) writes: [...] >>> 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! > > Did you actually test this? Oops, let me clarify. Command-line arguments are indeed decoded encoding to the locale encoding (that’s commit ed4c3739668b4b111b38555b8bc101cb74c87c1c.) When making a syscall like open(2), Guile converts strings to the locale encoding. However, in 2.0, the current locale is *not* installed; you have to either call ‘setlocale’ explicitly (like in C), or set this environment variable (info "(guile) Environment Variables"): GUILE_INSTALL_LOCALE=1 When you do that (and this will be the default in 2.2), things work as expected: --8<---------------cut here---------------start------------->8--- $ GUILE_INSTALL_LOCALE=1 guile λ.scm ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/ludo/src/guile/λ.scm ;;; compiled /home/ludo/.cache/guile/ccache/2.0-LE-8-2.0/home/ludo/src/guile/λ.scm.go hello λ! $ locale LANG=en_US.utf8 LC_CTYPE="en_US.utf8" LC_NUMERIC="en_US.utf8" LC_TIME="en_US.utf8" LC_COLLATE="en_US.utf8" LC_MONETARY="en_US.utf8" LC_MESSAGES="en_US.utf8" LC_PAPER=fr_FR.utf8 LC_NAME="en_US.utf8" LC_ADDRESS="en_US.utf8" LC_TELEPHONE="en_US.utf8" LC_MEASUREMENT="en_US.utf8" LC_IDENTIFICATION="en_US.utf8" LC_ALL= --8<---------------cut here---------------end--------------->8--- Sorry for the confusion! Ludo’.