guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transcoder library


From: Mike Gran
Subject: Re: Transcoder library
Date: Wed, 01 Apr 2009 22:46:21 -0700

On Wed, 2009-04-01 at 23:24 +0200, Ludovic Courtès wrote:
> Hi Mike,
> 
> Mike Gran <address@hidden> writes:

> > Basically, one would create a transcoder like this...
> >
> > (define TC (make-transcoder "UTF-8"))
> > ... and then use it either to read codepoints from encoded files ...
> >
> > (read-codepoint PORT TC)
> > (write-codepoint CODEPOINT PORT TC)
> 
> That would be roughly equivalent to the procedures in R6RS Section
> 8.2.9, right?
> 

That was the intention.  R6RS has the transcoder as a property of the
port, so I wrote port and transcoder side-by-side to imply that
association.  

> > (locale-string->u32vector STRING TC)
> > (u32vector->locale-string U32VECTOR TC)
> 
> FWIW, I implemented the `string->utf*' and `utf*->string' procedures
in
> Guile-R6RS-Libs [0,1] using the relevant Gnulib modules.  I'm planning
> to integrate it in Guile `master' at some point; would that be helpful
> to you to put it all together?
> 

Funny.  I did actually look through Guile-R6RS before putting this
together, but, somehow I overlooked that.  Yours has the feature of
dealing with various sizes of int.  Nice.  Mine has some of the ugly
code required to deal with the conversion of line endings that R6RS
requests.

With respect to the greater goal of wide strings in Guile, I have
played with it quite a bit, though I haven't posted much code. Now, I
am convinced that the character encoding should be a property of the
port.  It would be helpful, then, to have R6RS ports integrated at some
point.

Thanks,

Mike Gran






reply via email to

[Prev in Thread] Current Thread [Next in Thread]