All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: James Knight <james.d.knight@live.com>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2 1/1] utils/getdeveloperlib.py: explicitly set devs document encoding
Date: Sat, 18 Sep 2021 23:17:21 +0200	[thread overview]
Message-ID: <87ilyxshwe.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <DM6PR08MB39931F9CC3A0472896C5CD87A0D19@DM6PR08MB3993.namprd08.prod.outlook.com> (James Knight's message of "Sat, 4 Sep 2021 21:35:19 -0400")

>>>>> "James" == James Knight <james.d.knight@live.com> writes:

 > Explicitly indicate the file encoding to UTF-8 for the DEVELOPERS
 > document. This prevents Unicode decoding errors when printing E-Mail
 > entries with Unicode characters on systems using an alternative default
 > encoding (e.g. 'CP1252').

 > This corrects the following observed error:

 >     $ ./utils/get-developers outgoing/*
 >     Traceback (most recent call last):
 >       File "utils\get-developers", line 105, in <module>
 >         __main__()
 >       File "utils\get-developers", line 47, in __main__
 >         devs = getdeveloperlib.parse_developers()
 >       File "...\buildroot\utils\getdeveloperlib.py", line 239, in parse_developers
 >         for line in f:
 >       File "...\Python<ver>\lib\encodings\cp1252.py", line 23, in decode
 >         return codecs.charmap_decode(input,self.errors,decoding_table)[0]
 >     UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 6659: character maps to <undefined>

 > Signed-off-by: James Knight <james.d.knight@live.com>

Hmm, this doesn't quite seem to work when stdout is not a UTF-8 console
(E.G. when using as git send-email --cc-cmd):

echo $LANG
en_DK.UTF-8

./utils/get-developers -p libyang
Heiko Thiery <heiko.thiery@gmail.com>
Jan Kundrát <jan.kundrat@cesnet.cz>

LANG=C ./utils/get-developers -p libyang
Heiko Thiery <heiko.thiery@gmail.com>
Traceback (most recent call last):
  File "./utils/get-developers", line 105, in <module>
    __main__()
  File "./utils/get-developers", line 68, in __main__
    print(dev.name)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 9: ordinal not in range(128)

./utils/get-developers -p libyang | cat
Traceback (most recent call last):
  File "./utils/get-developers", line 105, in <module>
    __main__()
  File "./utils/get-developers", line 68, in __main__
    Heiko Thiery <heiko.thiery@gmail.com>
print(dev.name)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 9: ordinal not in range(128)


Reverting 9f127cc420884ad fixes it:

./utils/get-developers -p libyang
Heiko Thiery <heiko.thiery@gmail.com>
Jan Kundrát <jan.kundrat@cesnet.cz>

LANG=C ./utils/get-developers -p libyang
Heiko Thiery <heiko.thiery@gmail.com>
Jan Kundrát <jan.kundrat@cesnet.cz>

./utils/get-developers -p libyang | cat
Heiko Thiery <heiko.thiery@gmail.com>
Jan Kundrát <jan.kundrat@cesnet.cz>


Any idea about how to fix this, or should it just be reverted?

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2021-09-18 21:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-05  1:35 [Buildroot] [PATCH v2 1/1] utils/getdeveloperlib.py: explicitly set devs document encoding James Knight
2021-09-05 14:08 ` Thomas Petazzoni
2021-09-10 11:34 ` Peter Korsgaard
2021-09-10 14:39   ` Baruch Siach
2021-09-10 14:44     ` Peter Korsgaard
2021-09-18 21:17 ` Peter Korsgaard [this message]
2021-09-19  2:37   ` James Knight

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=87ilyxshwe.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.com \
    --cc=buildroot@buildroot.org \
    --cc=james.d.knight@live.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.