Sublime Forum

Stupid encodings

#1

Then, I was happy to see a change to python3, I were thinking yay, the end of encoding problems!

Today, I’ve had this code:

stdout, stderr = process.communicate()

and stdout, stderr can contain invalid characters… then with this:
[/code]

stdout, stderr = process.communicate() stdout = stdout.decode('utf-8', 'ignore');
You may fix it, by converting and ignoring these bad chars.

You need to remove

universal_newlines=True

from the call to subprocess.Popen(
if not, process.communicate will raise an internal python error

my locale is cp1252 and I can’t change it.

{2cents}

0 Likes

#2

universal_newlines is already left at the default value of False.

If you have a command emitting data in something other than utf-8, then you can specify the encoding in the Build System with the encoding argument.

0 Likes

#3

if I’d known you were going to respond, would have written something else. :smiley:

haha, laugh with me :smiley:

regards

0 Likes