From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: guile can't find a chinese named file Date: Mon, 30 Jan 2017 15:20:15 +0100 Message-ID: <874m0gd3z4.fsf@gnu.org> References: 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 1485788378 17358 195.159.176.226 (30 Jan 2017 14:59:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 30 Jan 2017 14:59:38 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Jan 30 15:59:34 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 1cYDQY-0004EI-2f for guile-user@m.gmane.org; Mon, 30 Jan 2017 15:59:30 +0100 Original-Received: from localhost ([::1]:33099 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYDQd-00077T-19 for guile-user@m.gmane.org; Mon, 30 Jan 2017 09:59:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYCtP-0003vD-AW for guile-user@gnu.org; Mon, 30 Jan 2017 09:25:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYCtM-0003ay-7H for guile-user@gnu.org; Mon, 30 Jan 2017 09:25:15 -0500 Original-Received: from [195.159.176.226] (port=42855 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYCtM-0003Zh-0u for guile-user@gnu.org; Mon, 30 Jan 2017 09:25:12 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cYCtD-0006Tb-Ci for guile-user@gnu.org; Mon, 30 Jan 2017 15:25:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@blaine.gmane.org X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 11 =?utf-8?Q?Pluvi=C3=B4se?= an 225 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Cancel-Lock: sha1:Z0dadd2nOYma4t3JlioRhMuNkBY= 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:13136 Archived-At: 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! Ludo’.