guile-user
[Top][All Lists]
Advanced

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

string-ports issue on Windows


From: Christopher Lam
Subject: string-ports issue on Windows
Date: Tue, 16 Apr 2019 04:13:14 +0000

Dear All

I'm struggling with string-ports on Windows.

Last para of
https://www.gnu.org/software/guile/manual/html_node/String-Ports.html
"With string ports, the port-encoding is treated differently than other
types of ports. When string ports are created, they do not inherit a
character encoding from the current locale. They are given a default locale
that allows them to handle all valid string characters."

This causes a string-sanitize function to not run correctly in Windows.
(locale-encoding) says "CP1252" no matter what LANG or setlocale I try.

The use case is to sanitize string for html, but on Windows it munges
extended-unicode. So i've had to resort to this uglier code:
https://pastebin.com/raw/ys4QrhMh which does work, but raises the question
why we have to do it in the first place.

It means *any* string-ports must be avoided to avoid cross-platform string
issues, right? It's a shame because (format) is quite useful.

Chris


reply via email to

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