Control: tags -1 + patch upstream Control: forwarded -1 codesp...@googlegroups.com
On Sun, 2014-09-28 at 19:56 +0200, Jakub Wilk wrote: > Package: codespell > Severity: minor > > $ printf '\xff' > test > $ codespell test > WARNING: Decoding file test > WARNING: using encoding=utf-8 failed. > WARNING: Trying next encoding: utf-8 > > > Of course if encoding=utf-8 failed, there is no point trying utf-8 > again. The last line should instead read: > > WARNING: Trying next encoding: iso-8859-1 The attached patch fixes this issue. -- bye, pabs https://wiki.debian.org/PaulWise
From 1527cb3899e5b488906056391191b4f42929c898 Mon Sep 17 00:00:00 2001 From: Paul Wise <pa...@bonedaddy.net> Date: Mon, 29 Sep 2014 08:11:30 +0800 Subject: [PATCH] Print the correct next encoding when falling back to other encodings Fixes: https://bugs.debian.org/763266 Signed-off-by: Paul Wise <pa...@bonedaddy.net> --- codespell.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/codespell.py b/codespell.py index 332bf4a..1eb53aa 100755 --- a/codespell.py +++ b/codespell.py @@ -171,8 +171,11 @@ class FileOpener: print('WARNING: using encoding=%s failed. ' % encodings[curr], file=sys.stderr) - print('WARNING: Trying next encoding: %s' % encodings[curr], - file=sys.stderr) + try: + print('WARNING: Trying next encoding: %s' % encodings[curr+1], + file=sys.stderr) + except IndexError: + pass curr += 1 -- 2.1.0
signature.asc
Description: This is a digitally signed message part