From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.user Subject: Re: guile can't find a chinese named file Date: Mon, 30 Jan 2017 16:48:13 +0100 Organization: Organization?!? Message-ID: <87tw8gr1ky.fsf@fencepost.gnu.org> References: <874m0gd3z4.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1485791396 2610 195.159.176.226 (30 Jan 2017 15:49:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 30 Jan 2017 15:49:56 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Jan 30 16:49:52 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYEDI-0000NJ-D8 for guile-user@m.gmane.org; Mon, 30 Jan 2017 16:49:52 +0100 Original-Received: from localhost ([::1]:33483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYEDK-00081C-LD for guile-user@m.gmane.org; Mon, 30 Jan 2017 10:49:54 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYEBr-0007St-Sg for guile-user@gnu.org; Mon, 30 Jan 2017 10:48:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYEBo-0001d8-QK for guile-user@gnu.org; Mon, 30 Jan 2017 10:48:23 -0500 Original-Received: from [195.159.176.226] (port=50209 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYEBo-0001cM-Jb for guile-user@gnu.org; Mon, 30 Jan 2017 10:48:20 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cYEBh-0005KW-8l for guile-user@gnu.org; Mon, 30 Jan 2017 16:48:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 91 Original-X-Complaints-To: usenet@blaine.gmane.org X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw Cancel-Lock: sha1:iK9bEa22+byLJ7FPvKP/FS1KCrE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:13137 Archived-At: ludo@gnu.org (Ludovic Courtès) writes: > Hi! > > Thomas Morley 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 # ...] >> In unknown file: >> ?: 7 [apply-smob/1 #] >> 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 #> ice-9/boot-9.scm:4051:3 ()>] >> 4058: 3 [#] >> 1727: 2 [%start-stack load-stack ...] >> 1732: 1 [#] >> 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! Did you actually test this? dak@lola:/usr/local/tmp/lilypond$ locale LANG=en_US.UTF-8 LANGUAGE=en LC_CTYPE="en_US.UTF-8" LC_NUMERIC=en_US.UTF-8 LC_TIME=en_US.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=en_US.UTF-8 LC_MESSAGES="en_US.UTF-8" LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8 LC_ALL= dak@lola:/usr/local/tmp/lilypond$ touch /tmp/f♯.scm dak@lola:/usr/local/tmp/lilypond$ guile-2.0 /tmp/f♯.scm ;;; Stat of /tmp/f?.scm failed: ;;; ERROR: In procedure stat: No such file or directory: "/tmp/f\u266f.scm" Backtrace: In ice-9/boot-9.scm: 160: 8 [catch #t # ...] In unknown file: ?: 7 [apply-smob/1 #] 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 #] 4056: 3 [#] 1727: 2 [%start-stack load-stack ...] 1732: 1 [#] In unknown file: ?: 0 [primitive-load "/tmp/f\u266f.scm"] ERROR: In procedure primitive-load: ERROR: In procedure open-file: No such file or directory: "/tmp/f\u266f.scm" dak@lola:/usr/local/tmp/lilypond$ ls -l /tmp/f*.scm -rw-rw-r-- 1 dak dak 0 Jan 30 16:42 /tmp/f♯.scm -- David Kastrup