chicken-users
[Top][All Lists]
Advanced

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

Re: cannot open file if name contains accented characters


From: felix . winkelmann
Subject: Re: cannot open file if name contains accented characters
Date: Mon, 25 Dec 2023 12:07:20 +0100

> Hi everyone,
>
> I want to read input from a file that contains accented characters in its
> name, and Chicken says that it can't open the file. The source code is
> saved in a UTF-8 encoded text file.
> [...]
> I use Windows, and I run the script in the Command Prompt. Before running
> it, I change the code page to UTF-8 with this command:
>
> chcp 65001

Hi!

I'm not too familiar with the way Windows handles non-ASCII characters
in operating system calls, but I assume that what gets passed to the C
library runtime functions like fopen(3), etc. assumes a particular encoding.

>From a quick glance at the Windows docs[1] it seems one needs to use
"_fwopen" with a wchar_t string argument to pass extended characters.
What you could do is to use the FFI to call "_fwopen" with a suitably converted
argument string and the use "open-input-file*" to convert it into a Scheme port
(Just ask if you need help with this).

Sorry, if this is not overly helpful. We are currently in the process of 
improving
the unicode support for the next major version of CHICKEN.


felix




reply via email to

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