From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.user Subject: Re: I'm looking for a method of converting a string's character encoding Date: Sat, 28 Apr 2012 21:54:54 +0200 Message-ID: <874ns3ws1d.fsf@gnuvola.org> References: <87obqbwykh.fsf@gnuvola.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1335642917 16744 80.91.229.3 (28 Apr 2012 19:55:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 28 Apr 2012 19:55:17 +0000 (UTC) Cc: guile-user@gnu.org, Sunjoong Lee To: Daniel Krueger Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Apr 28 21:55:13 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 1SODjY-0004Vo-HK for guile-user@m.gmane.org; Sat, 28 Apr 2012 21:55:08 +0200 Original-Received: from localhost ([::1]:40148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SODjX-0002cH-PW for guile-user@m.gmane.org; Sat, 28 Apr 2012 15:55:07 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33770) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SODjS-0002ac-PP for guile-user@gnu.org; Sat, 28 Apr 2012 15:55:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SODjR-0008Pl-34 for guile-user@gnu.org; Sat, 28 Apr 2012 15:55:02 -0400 Original-Received: from smtp206.alice.it ([82.57.200.102]:44483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SODjQ-0008OL-OQ for guile-user@gnu.org; Sat, 28 Apr 2012 15:55:01 -0400 Original-Received: from ambire (79.0.68.164) by smtp206.alice.it (8.6.023.02) id 4F9BF1D300075357; Sat, 28 Apr 2012 21:54:57 +0200 Original-Received: from ttn by ambire with local (Exim 4.72) (envelope-from ) id 1SODjK-0005sX-BI; Sat, 28 Apr 2012 21:54:54 +0200 In-Reply-To: (Daniel Krueger's message of "Sat, 28 Apr 2012 20:29:22 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.102 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:9417 Archived-At: () Daniel Krueger () Sat, 28 Apr 2012 20:29:22 +0200 i think there shouldn't be any transcoding of guile's strings, as strings are internal representation of characters, no matter how they are encoded. So the only time when encoding matters is when it passes it's `internal boundarys', i mean if you write the string to a port or read from a port or pass it as a string to a foreign library. Indeed, iconv(1) converts external representations (files). How it does that internally is an implementation detail. That's the main reason why i suggested it as a model for exercising Guile's internals -- it's very easy to check correctness. For the ports all transcoding is available, and as said, the real representation of guile strings internally is as utf8, which can't be changed. IIUC, the internal representation of strings is not UTF-8 (at least, not all the time), but anyway, that doesn't matter at all. The proposed task is to use procedures and features provided by Guile (i.e., its public API) to do mimic iconv. The only additional thing i forgot about are bytevectors, if you convert a string to an explicit representation, but afaik there you also can give the encoding to use. Am I wrong? I don't know.