[PATCH] force a UTF-8 locale for python3 to avoid broken ascii codec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The python3 ascii codec violates POSIX C locale requirements by not being
8-bit clean in its text handling. It raises an error for any byte with
top bit set

  >       return codecs.ascii_decode(input, self.errors)[0]
  E       UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 419: ordinal not in range(128)

To avoid this python bug we must force use of a UTF-8 locale. Ideally we
would use the C.UTF-8 locale, however, that is not portable across OS,
only existing on certain Linux distros. Instead we use the en_us.UTF-8
locale, but only for the character set data.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---

Pushed as a CI build fix for FreeBSD distros

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index c63cb6e..9d7f109 100644
--- a/Makefile
+++ b/Makefile
@@ -123,4 +123,4 @@ update-po:
         done
 
 check: $(DATA_FILES) $(SCHEMA_FILES)
-	$(PYTHON) -m pytest $(PYTEST_LOG_LEVEL)
+	LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8 $(PYTHON) -m pytest $(PYTEST_LOG_LEVEL)
-- 
2.20.1

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux