mit-scheme-users
[Top][All Lists]
Advanced

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

[MIT-Scheme-users] Re: *parser and UTF-8


From: Chris Hanson
Subject: [MIT-Scheme-users] Re: *parser and UTF-8
Date: Thu, 29 Jun 2006 15:18:04 -0400
User-agent: Thunderbird 1.5.0.4 (X11/20060619)

Kaloian Doganov wrote:

> (call-with-input-file "sample-data.txt"
>   (lambda (port)
>       (display ((*parser (seq (match (* (alphabet full-alphabet)))))
>                         (input-port->parser-buffer port)))))
> ----------8<----------
> 
> should display:
> 
>    #(Когато бях овчарче и овците пасях
>    )
> 
> but it displays:
> 
>    #(Когато бях овчарче и овците пасях...
>    )
> 
> Which looks like UTF-8 byte sequence parsed as ISO-8859-1.  Or perhaps
> the data itself is parsed properly, but the `display' procedure is not
> capable to handle it?
> 
> What I am doing wrong?

By default, ports start in a simple coding -- you need to switch the
coding after the port is opened:

(call-with-input-file "sample-data.txt"
  (lambda (port)
    (port/set-coding port 'utf-8)
    ...)))





reply via email to

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