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)
    ...)))



_______________________________________________
MIT-Scheme-users mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/mit-scheme-users

Reply via email to