List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH] filter: set environment variable PYTHONIOENCODING to utf-8
Date: Sun, 12 Mar 2017 17:51:53 +0000	[thread overview]
Message-ID: <20170312175153.GM2102@john.keeping.me.uk> (raw)
In-Reply-To: <CAHmME9oto9bEvc9j5yh8FcCJ1qSYEDqp5VmNS9YbvD6zgut22Q@mail.gmail.com>

On Sun, Mar 12, 2017 at 10:01:10AM -0700, Jason A. Donenfeld wrote:
> Sorry for the delay. I'm currently on the road traveling and won't be
> properly back at my desk until the end of next week.
> 
> However, my initial reaction is that hard coding various
> interpreter-specific environment variables in cgit itself is not
> correct, and that this is something better left to the CGI environment
> as it sees fit. However, we may benefit from explicit script level
> configuration of unicode stuff.

While I'm inclined to agree with this, in this particular case we
explicitly encode pages as UTF-8 so there is an argument that we should
be telling child processes that UTF-8 is the correct encoding.

Maybe we should be looking to change LANG instead, but I'm not sure how
reliably we can do that.  Is it safe to do something like:

	const char *lang = getenv("LANG");
	struct strbuf sb = STRBUF_INIT;

	if (!lang)
		lang = "C";
	strbuf_addf(&sb, "%.*s.UTF-8",
		    (int) (strchrnul(lang, '.') - lang), lang);
	setenv("LANG", sb.buf);

?


  reply	other threads:[~2017-03-12 17:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23 15:48 roy
2017-03-04 12:35 ` john
2017-03-06  9:14   ` roy
2017-03-08 19:01     ` roy
2017-03-09  0:10       ` john
2017-03-12 17:01         ` Jason
2017-03-12 17:51           ` john [this message]
2017-03-17 18:07             ` Jason
2017-03-17 20:04               ` john
2017-03-17 20:13                 ` roy
2017-08-10 14:04                   ` Jason
2017-03-09  0:18 roy
2017-03-10 15:28 ` john

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170312175153.GM2102@john.keeping.me.uk \
    --to=cgit@lists.zx2c4.com \
    /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.
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 NNTP newsgroup(s).