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

Process().username() return badly decoding character #964

Closed
PierreF opened this issue Feb 1, 2017 · 1 comment
Closed

Process().username() return badly decoding character #964

PierreF opened this issue Feb 1, 2017 · 1 comment

Comments

@PierreF
Copy link
Contributor

PierreF commented Feb 1, 2017

On a Windows 10 using French locale, I have wrong character on my username:

> python.exe -c "import psutil;print(psutil.Process().username())
MSEDGEWIN10\D�mo

In reality the user is named "Démo".

Call to user is also affected:

> python.exe -c "import psutil;print(psutil.users())
[suser(name='D�mo', ...

Version tested:

  • Python 3.6.0 - amd64 (using official Python webinstaller)
  • Python 3.6.0 - 32 bits (using embedded Python)

psutil version 5.0.1 from pypi (wheel, not built locally).

My current guess is that from my understanding of documentation of Microsoft, result from API are using a Windows code page (cp1252 in my case) and psutil decode using Py_FileSystemDefaultEncoding (utf-8 in my case).

@giampaolo
Copy link
Owner

The same issue should affect at least also psutil.users().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants