Skip to content

Commit

Permalink
Utils: Always use utf-8 when handling QByteArray data in ProcessWorker
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Oct 21, 2024
1 parent f4ca94a commit 4389853
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions spyder/utils/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# Standard library imports
from collections import deque
import logging
import os
import sys

# Third party imports
Expand Down Expand Up @@ -124,17 +123,11 @@ def __init__(self, parent, cmd_list, environ=None):
self._process.readyReadStandardOutput.connect(self._partial)

def _get_encoding(self):
"""Return the encoding/codepage to use."""
enco = 'utf-8'

# Currently only cp1252 is allowed?
if os.name == 'nt':
import ctypes
codepage = to_text_string(ctypes.cdll.kernel32.GetACP())
# import locale
# locale.getpreferredencoding() # Differences?
enco = 'cp' + codepage
return enco
"""Return the encoding to use."""
# It seems that in Python 3 we only need this encoding to correctly
# decode bytes on all operating systems.
# See spyder-ide/spyder#22546
return 'utf-8'

def _set_environment(self, environ):
"""Set the environment on the QProcess."""
Expand Down

0 comments on commit 4389853

Please sign in to comment.