Hi Mark,

Mark H Weaver <[email protected]> skribis:

> [email protected] (Ludovic Courtès) writes:
>> It may be that your string ports are created with a non-Unicode-capable
>> encoding.  Try something like:
>>
>>   (define p
>>     (with-fluids ((%default-port-encoding "UTF-8"))
>>       (open-input-string "čtyří")))
>
> IMO, this should not be needed.  Port encodings should only be relevant
> when reading from ports involving byte strings, such as file ports or
> socket ports.  The encoding used by Scheme strings is a purely internal
> matter; from the user's perspective, Scheme strings are simply a
> sequence of Unicode code points.

Note that “UTF-8” above has nothing to do with Guile’s internal string
representation; it’s just one of the many encodings that can represent
“čtyří”.

> What _is_ needed is a file coding declaration near the top of the source
> file, e.g. "coding: utf-8" (see "Character Encoding of Source Files" in
> the manual).

Yes.  And you actually need both–i.e., the ‘coding’ cookie won’t
magically make string ports use that encoding.

> I tried that and it still fails for me.

What fails exactly?

Thanks,
Ludo’.



Reply via email to