From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.user Subject: Re: gh_repl Date: Mon, 09 Jan 2012 16:18:04 -0500 Message-ID: <87obuca837.fsf@netris.org> References: <1316922872.25009.YahooMailNeo@web37901.mail.mud.yahoo.com> <87wr907pa1.fsf@pobox.com> <1326132716.20961.YahooMailNeo@web37903.mail.mud.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1326143934 12416 80.91.229.12 (9 Jan 2012 21:18:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 9 Jan 2012 21:18:54 +0000 (UTC) Cc: Guile User To: Mike Gran Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Jan 09 22:18:50 2012 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RkMcE-0001Lm-Gv for guile-user@m.gmane.org; Mon, 09 Jan 2012 22:18:50 +0100 Original-Received: from localhost ([::1]:42685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkMcE-0007Bt-20 for guile-user@m.gmane.org; Mon, 09 Jan 2012 16:18:50 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:47466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkMc9-0007Bn-Tc for guile-user@gnu.org; Mon, 09 Jan 2012 16:18:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkMc8-0004oi-CA for guile-user@gnu.org; Mon, 09 Jan 2012 16:18:45 -0500 Original-Received: from world.peace.net ([96.39.62.75]:40724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkMc8-0004YY-9q for guile-user@gnu.org; Mon, 09 Jan 2012 16:18:44 -0500 Original-Received: from c-98-216-245-176.hsd1.ma.comcast.net ([98.216.245.176] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1RkMbs-00037O-5M; Mon, 09 Jan 2012 16:18:28 -0500 In-Reply-To: <1326132716.20961.YahooMailNeo@web37903.mail.mud.yahoo.com> (Mike Gran's message of "Mon, 9 Jan 2012 10:11:56 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 96.39.62.75 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:9112 Archived-At: Mike Gran writes: > =C2=A0=C2=A0 scm_from_locale_symbol ("scheme")); Note that it's good practice to always use `scm_from_utf8_symbol' or `scm_from_latin1_symbol' when the argument is a C string literal. The choice of which (`utf8' or `latin1') depends on the encoding of your C source file. Similarly, for creating strings and keywords from C string literals, use `scm_from_{utf8,latin1}_string' or `scm_from_{utf8,latin1}_keyword'. (though unfortunately Guile 1.8 did not include any of these functions). In this case it doesn't matter because the C string literal contains only ASCII characters, and all locale encodings are ASCII compatible. However, if you added non-ASCII characters to the string literal, your program would fail unless the user's locale encoding happened to match that of your source code. More importantly, since many people tend to copy code snippets from what they see here and elsewhere, it's good to start spreading good i18n habits. The key idea to spread is: it's wrong to use the user's locale to interpret a C string literal. Thanks, Mark