From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: msematman@myopera.com Newsgroups: gmane.lisp.guile.user Subject: Re: displaying UTF8 characters in and out of a script (guile 2.0.5) Date: Mon, 17 Dec 2012 13:18:14 +0100 Message-ID: <1355746694.17729.140661167007929.19DCB030@webmail.messagingengine.com> References: <1355685754.7015.140661166743981.0F8ECFCA@webmail.messagingengine.com> <20121216180452.0820b094@capac> <871uep4u3s.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1355746717 21622 80.91.229.3 (17 Dec 2012 12:18:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Dec 2012 12:18:37 +0000 (UTC) Cc: guile-user@gnu.org, David Pirotte To: Mark H Weaver Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Dec 17 13:18:51 2012 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TkZel-0007FW-4o for guile-user@m.gmane.org; Mon, 17 Dec 2012 13:18:51 +0100 Original-Received: from localhost ([::1]:54133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkZeX-0000Um-Pu for guile-user@m.gmane.org; Mon, 17 Dec 2012 07:18:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkZeM-0000U5-Tc for guile-user@gnu.org; Mon, 17 Dec 2012 07:18:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkZeE-000895-RQ for guile-user@gnu.org; Mon, 17 Dec 2012 07:18:26 -0500 Original-Received: from new1-smtp.messagingengine.com ([66.111.4.221]:49503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkZeE-00088v-Jb for guile-user@gnu.org; Mon, 17 Dec 2012 07:18:18 -0500 Original-Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 690A7597; Mon, 17 Dec 2012 07:18:18 -0500 (EST) Original-Received: from web6.nyi.mail.srv.osa ([10.202.2.216]) by compute4.internal (MEProxy); Mon, 17 Dec 2012 07:18:18 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:cc:mime-version :content-transfer-encoding:content-type:subject:date:in-reply-to :references; s=smtpout; bh=kxHs7Vn/Ib4LyqVGgVVsuD8EBdM=; b=h3tCL 16gdUPZJHdpwytenjeErC/FOAoLiLJJ5oDjkOfU6BvZUf9EXVYaI62hjnUJQfato 8g8TFKLmw35riUvISM7Ib4jEMtniX3fVejeoLmG8XQi1qeK6s2oc96MNlCGzAVpA pUQlP6ik/oXsWa8NkoDvM1IRO9ZFviEoTX2hI0= Original-Received: by web6.nyi.mail.srv.osa (Postfix, from userid 99) id 8091421375; Mon, 17 Dec 2012 07:18:14 -0500 (EST) X-Sasl-Enc: 4mRlneUouJuvTssxSG0tW98TsmLLEAiSPyvLNiLitktP 1355746694 X-Mailer: MessagingEngine.com Webmail Interface - ajax-32b5e02e In-Reply-To: <871uep4u3s.fsf@tines.lan> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.111.4.221 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 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-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9762 Archived-At: On Sun, Dec 16, 2012, at 09:31 PM, Mark H Weaver wrote: > David Pirotte writes: >=20 > >> However, the same command in a script: > >>=20 > >> #!/usr/bin/guile \ > >> -s > >> #! > >> (display "=C4=86i=C4=87olina") > >>=20 > >> writes this out: ?i?olina > > > > you need to set the port encoding first [for further info see section '= 6.14.1 Ports' > > of the manual]: >=20 > Unfortunately that is only a partial solution (it changes the encoding > of the current-output-port only, not for anything else), and it assumes > that the user wants UTF-8 output. >=20 > A more comprehensive solution is to put this: >=20 > (setlocale LC_ALL "") >=20 > at the beginning of the script, which will set the locale according to > the user's settings (as specified by the environment variables). This > is what Guile does when starting an interactive session, and what most > other interactive programs and scripting languages do as well. >=20 > Also, since your script contains non-ASCII characters, you should place > a coding declaration in the file so that Guile will know what encoding > to use when reading it. If your script is in UTF-8, then put this in > the first 500 characters of the file: >=20 > ;;; coding: utf-8 >=20 > For more details, see: >=20 > http://www.gnu.org/software/guile/manual/html_node/Character-Encoding-o= f-Source-Files.html >=20 > If you do these things, then your script should work properly even when > run by a user who has configured a non-UTF-8 locale. >=20 > Regards, > Mark David, Mark, Thanks for the detailed explanation, it works now. Cheers --=20 =20=20 msematman@myopera.com