Skip to content

Commit

Permalink
SConstruct : Check for utf-8 using codec registry
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Aug 8, 2023
1 parent c272f01 commit bec54e8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit bec54e8

Please sign in to comment.