[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: utf8 printing problem
From: |
Mario Domenech Goulart |
Subject: |
Re: utf8 printing problem |
Date: |
Sat, 23 Jul 2022 20:03:35 +0200 |
Hi Mátyás,
On Sat, 23 Jul 2022 11:13:39 +0200 Mátyás Seress <serimatyi@gmail.com> wrote:
> I wanted to try out printing some utf8 text to the console, but I ran into
> some issues. This is my program:
>
> (import utf8)
> (print "őŐűŰ")
>
> And when I run it on the command line with
>
> csi test-utf.scm
>
> then I get this output:
>
> CHICKEN
> (c) 2008-2019, The CHICKEN Team
> (c) 2000-2007, Felix L. Winkelmann
> Version 5.1.0 (rev 8e62f718)
> mingw32-windows-gnu-x86 [ dload ptables ]
>
> ; loading test-utf.scm ...
> ; loading c:/chicken/lib/chicken/11/utf8.import.so ...
>
<snip>
> ; loading c:/chicken/lib/chicken/11/utf8.so ...
> ; loading c:/chicken/lib/chicken/11/regex.so ...
> ; loading c:/chicken/lib/chicken/11/utf8-lolevel.so ...
> őŐűŰ
>
> As you can see, it prints ┼æ┼É┼▒┼░ instead of őŐűŰ. When I write a
> similar program in C# it does it correctly by default. It seems that
> the (import utf8) has no effect at all, because if I comment out the
> (import utf8) line and run it, then I get the same exact weird output.
>
> What am I doing wrong? How can I properly work with strings that
> contain non-English characters? (Btw the file is saved with UTF-8
> encoding and I'm using Windows.)
I cannot reproduce that problem with CHICKEN 5.3 on Debian.
$ cat u.scm
(import utf8)
(print "őŐűŰ")
$ csi -s u.scm
őŐűŰ
Isn't the problem related to your terminal? Maybe redirect the output
of your program to a file and open it in an editor that supports UTF-8
to see if the problem persists.
All the best.
Mario
--
http://parenteses.org/mario