diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-04 06:49:44 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-04 06:49:44 +0200 |
commit | cd84364e63303dfec6fa4decbf8a78ac631ccf24 (patch) | |
tree | 09a3d556e3120bda1a997bbb219a55a5e26c4a81 | |
parent | 91f26bb3bd08b5bf1db3d185274986962c8bd15a (diff) | |
download | psutil-cd84364e63303dfec6fa4decbf8a78ac631ccf24.tar.gz |
update doc
-rw-r--r-- | docs/index.rst | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/docs/index.rst b/docs/index.rst index 509d5f9c..02f93570 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2244,26 +2244,27 @@ Constants Unicode ======= -Starting from version 5.3.0 psutil -`fully supports unicode <https://github.com/giampaolo/psutil/issues/1040>`__. -The notes below apply to *any* method returning a string such as +Starting from version 5.3.0 psutil fully supports unicode, see +`issue #1040 <https://github.com/giampaolo/psutil/issues/1040>`__. +The notes below apply to *any* API returning a string such as :meth:`Process.exe` or :meth:`Process.cwd`, including non-filesystem related -methods such as :meth:`Process.username`: +methods such as :meth:`Process.username` or :meth:`WindowsService.description`: * all strings are encoded by using the OS filesystem encoding which varies - depending on the platform you're on (e.g. UTF-8 on Linux, mbcs on Win) + depending on the platform (e.g. UTF-8 on Linux, mbcs on Win) * no API call is supposed to crash with ``UnicodeDecodeError`` -* instead, in case of badly encoded data returned by the OS, the following error handlers are used to replace the bad characters in the string: - * Python 2: ``"replace"`` +* instead, in case of badly encoded data returned by the OS, the following error handlers are used to replace the corrupted characters in the string: * Python 3: ``"surrogatescape"`` on POSIX and ``"replace"`` on Windows + * Python 2: ``"replace"`` * on Python 2 all APIs return bytes (``str`` type), never ``unicode`` -* on Python 2 you can go back to unicode by doing: +* on Python 2, you can go back to ``unicode`` by doing: .. code-block:: python >>> unicode(p.exe(), sys.getdefaultencoding(), errors="replace") -Example which filters processes with a funky name working with Python 2 and 3:: +Example which filters processes with a funky name working with both Python 2 +and 3:: # -*- coding: utf-8 -*- import psutil, sys |