From: Andrew Tropin <andrew@trop.in>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 49082-done@debbugs.gnu.org
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 [thread overview]
Message-ID: <87a6nfoovd.fsf@trop.in> (raw)
In-Reply-To: <875yy4uupe.fsf@gnu.org>
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’.
prev parent reply other threads:[~2021-06-24 4:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 4:15 [bug#49082] [PATCH] guix: gexp: Make UTF-8 a default port encoding in mixed-text-file Andrew Tropin
2021-06-18 7:55 ` Leo Prikler
2021-06-18 16:21 ` Andrew Tropin
2021-06-18 16:39 ` Leo Prikler
2021-06-18 17:21 ` Andrew Tropin
2021-06-23 21:39 ` bug#49082: " Ludovic Courtès
2021-06-24 4:41 ` Andrew Tropin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a6nfoovd.fsf@trop.in \
--to=andrew@trop.in \
--cc=49082-done@debbugs.gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).