[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#49082] [PATCH] guix: gexp: Make UTF-8 a default port encoding in mi
From: |
Andrew Tropin |
Subject: |
[bug#49082] [PATCH] guix: gexp: Make UTF-8 a default port encoding in mixed-text-file |
Date: |
Thu, 24 Jun 2021 07:41:58 +0300 |
Ludovic Courtès <ludo@gnu.org> writes:
> Hi,
>
> Andrew Tropin <andrew@trop.in> skribis:
>
>> guix/gexp.scm (mixed-text-file): It's necessary because if some UTF-8 symbols
>> appear in configuration, resulting file in the store will contain ? instead
>> of
>> it.
>
> Good catch! Applied as 1f3d7b45349d43e5cc02594083e0cd44ef730992.
Thank you very much!)
> Please look how I modified the commit log, in line with our conventions
> and previous entries for this file.
>
>> (define build
>> (gexp (call-with-output-file (ungexp output "out")
>> (lambda (port)
>> + (set-port-encoding! port "UTF-8")
>
> Leo is right that we’d often write:
>
> (parameterize ((%default-port-encoding "UTF-8"))
> (call-with-output-file …))
>
> because it’s marginally cleaner (the port is created with the right
> encoding from the start). In this case it doesn’t matter much though.
Got it, I thought Leo meant to wrap (mixed-text-file ...) into
parametrize, which probably won't work, because gexp will be avaluated
in different environment. Sorry for missunderstanding!) Leo, Ludo,
thank you for explanation!
> Thank you!
>
> Ludo’.