From 856d98c72f05d1d678b7db84e20eda20c66b0da6 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 1 Feb 2023 15:32:29 +0100 Subject: [PATCH] document another way to get UTF-8 encoding on stdin/stdout/stderr, fixes #2273 --- docs/internals/frontends.rst | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/internals/frontends.rst b/docs/internals/frontends.rst index ca4d28581..fbd467e07 100644 --- a/docs/internals/frontends.rst +++ b/docs/internals/frontends.rst @@ -18,9 +18,6 @@ Important: JSON output is expected to be UTF-8, but currently borg depends on th for that (must be a UTF-8 locale and *not* "C" or "ascii"), so that Python will choose to encode to UTF-8. The same applies to any inputs read by borg, they are expected to be UTF-8 encoded also. -We consider this a bug (see :issue:`2273`) and might fix it later, so borg will use UTF-8 independent of -the locale. - On POSIX systems, you can usually set environment vars to choose a UTF-8 locale: :: @@ -29,6 +26,17 @@ On POSIX systems, you can usually set environment vars to choose a UTF-8 locale: export LC_CTYPE=en_US.UTF-8 +Another way to get Python's stdin/stdout/stderr streams to use UTF-8 encoding (without having +a UTF-8 locale / LANG / LC_CTYPE) is: + +:: + + export PYTHONIOENCODING=utf-8 + + +See :issue:`2273` for more details. + + Dealing with non-unicode byte sequences and JSON limitations ------------------------------------------------------------