Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Always use utf-8 when handling QByteArray data in ProcessWorker (Utils) #22656

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
dalthviz marked this conversation as resolved.
Show resolved Hide resolved

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