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.devel Subject: Re: string port encodings Date: Tue, 15 Jan 2013 13:46:59 -0500 Message-ID: <871udmqo64.fsf@tines.lan> References: <87wqvems2s.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1358275651 3465 80.91.229.3 (15 Jan 2013 18:47:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Jan 2013 18:47:31 +0000 (UTC) Cc: guile-devel To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jan 15 19:47:48 2013 Return-path: Envelope-to: guile-devel@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 1TvBY3-0004lG-W2 for guile-devel@m.gmane.org; Tue, 15 Jan 2013 19:47:48 +0100 Original-Received: from localhost ([::1]:39671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvBXn-0004xI-Ly for guile-devel@m.gmane.org; Tue, 15 Jan 2013 13:47:31 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:34099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvBXk-0004xD-BD for guile-devel@gnu.org; Tue, 15 Jan 2013 13:47:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvBXj-0000wQ-6q for guile-devel@gnu.org; Tue, 15 Jan 2013 13:47:28 -0500 Original-Received: from world.peace.net ([96.39.62.75]:33163) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvBXj-0000uD-28 for guile-devel@gnu.org; Tue, 15 Jan 2013 13:47:27 -0500 Original-Received: from 209-6-92-20.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.92.20] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TvBXQ-0008Ox-Gb; Tue, 15 Jan 2013 13:47:08 -0500 In-Reply-To: <87wqvems2s.fsf@pobox.com> (Andy Wingo's message of "Tue, 15 Jan 2013 15:36:11 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 96.39.62.75 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:15431 Archived-At: Hi Andy, Andy Wingo writes: > Quiz: what does this do? > > (define (f s) > (with-output-to-string (lambda () (display s)))) > > When called with a string, what should it do? Like (f "foo"). > > If you answered, "return the string", that's what I would think it > should do. > > But no, currently the answer is locale-specific. It encodes the string > according to the current locale, then decodes it from that encoding. If > your locale can't encode the string, tough luck for you! > > This is a bit crazy. Surely the port should be textual? Surely the > default encoding for a string port should be utf-8 or something that can > actually handle all strings? I agree wholeheartedly. Unfortunately, the current broken behavior of string ports has been recommended in our official forums as a clever way to do arbitrary iconv conversions. Nonetheless, I still think it ought to be fixed properly in 2.2. Here are some past discussions on this topic: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11197 http://comments.gmane.org/gmane.lisp.guile.devel/14533 Mark