From bec54e827a6d99743bad09c9efa5a89e4638ed08 Mon Sep 17 00:00:00 2001 From: Eric Mehl Date: Wed, 26 Jul 2023 15:27:28 -0400 Subject: [PATCH] SConstruct : Check for utf-8 using codec registry --- SConstruct | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index dfdbac8a501..20099fe448f 100644 --- a/SConstruct +++ b/SConstruct @@ -45,10 +45,11 @@ import platform import shutil import subprocess import distutils.dir_util +import codecs EnsureSConsVersion( 3, 0, 2 ) # Substfile is a default builder as of 3.0.2 -if locale.getpreferredencoding() != "UTF-8" : +if codecs.lookup( locale.getpreferredencoding() ).name != "utf-8" : # The `Substfile` builder uses `open()` without specifying an encoding, and # so gets Python's default encoding. Unless this is `UTF-8`, any `.py` files # containing unicode characters will be corrupted during installation.