Describe the bug
When I use PlatformIO to compile an STM32 program, I encounter a linking failure error. After debugging, I found that when the command becomes too long, the command arguments are written into a temporary file using the TempFileMunge method. However, since I'm using the Chinese version of Windows, the default encoding is cp936. If the temporary file is written using UTF-8 encoding, it causes errors when gcc tries to read it.
On the other hand, if the temporary file is written using GBK encoding, everything works fine.
os.write(fd, bytearray(join_char.join(args) + "\n", 'gbk'))
Therefore, the correct encoding should be selected based on the system's default locale when writing the temporary file.
Required information
- Link to SCons Users thread discussing your issue.
- Version of SCons
scons-local-4.8.1
- Version of Python
Python 3.11.7 (tags/v3.11.7:fa7a6f2, Dec 4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)] on win32
- Which python distribution if applicable (python.org, cygwin, anaconda, macports, brew,etc)
- How you installed SCons
- What Platform are you on? (Linux/Windows and which version)
Windows 10 Pro 22H2 19045.6093 (Chinese Version)
- How to reproduce your issue? Please include a small self contained reproducer. Likely a SConstruct should do for most issues.
- How you invoke scons (The command line you're using "scons --flags some_arguments")
Describe the bug
When I use PlatformIO to compile an STM32 program, I encounter a linking failure error. After debugging, I found that when the command becomes too long, the command arguments are written into a temporary file using the TempFileMunge method. However, since I'm using the Chinese version of Windows, the default encoding is cp936. If the temporary file is written using UTF-8 encoding, it causes errors when gcc tries to read it.
On the other hand, if the temporary file is written using GBK encoding, everything works fine.
Therefore, the correct encoding should be selected based on the system's default locale when writing the temporary file.
Required information
scons-local-4.8.1
Python 3.11.7 (tags/v3.11.7:fa7a6f2, Dec 4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)] on win32
Windows 10 Pro 22H2 19045.6093 (Chinese Version)