Functions | |
| def | _get_console_encoding (stream) |
| def | console_decode (string, encoding=CONSOLE_ENCODING) |
| Decodes bytes from console encoding to Unicode. More... | |
| def | console_encode (string, encoding=None, errors='replace', stream=sys.__stdout__, force=False) |
| Encodes the given string so that it can be used in the console. More... | |
| def | system_decode (string) |
| def | system_encode (string) |
Variables | |
| CONSOLE_ENCODING = get_console_encoding() | |
| PYTHONIOENCODING = os.getenv('PYTHONIOENCODING') | |
| SYSTEM_ENCODING = get_system_encoding() | |
|
private |
Definition at line 73 of file encoding.py.
| def robot.utils.encoding.console_decode | ( | string, | |
encoding = CONSOLE_ENCODING |
|||
| ) |
Decodes bytes from console encoding to Unicode.
By default uses the system console encoding, but that can be configured using the `encoding` argument. In addition to the normal encodings, it is possible to use case-insensitive values `CONSOLE` and `SYSTEM` to use the system console and system encoding, respectively. If `string` is already Unicode, it is returned as-is.
Definition at line 39 of file encoding.py.
| def robot.utils.encoding.console_encode | ( | string, | |
encoding = None, |
|||
errors = 'replace', |
|||
stream = sys.__stdout__, |
|||
force = False |
|||
| ) |
Encodes the given string so that it can be used in the console.
If encoding is not given, determines it based on the given stream and system configuration. In addition to the normal encodings, it is possible to use case-insensitive values `CONSOLE` and `SYSTEM` to use the system console and system encoding, respectively. By default decodes bytes back to Unicode because Python 3 APIs in general work with strings. Use `force=True` if that is not desired.
Definition at line 60 of file encoding.py.
| def robot.utils.encoding.system_decode | ( | string | ) |
Definition at line 82 of file encoding.py.
| def robot.utils.encoding.system_encode | ( | string | ) |
Definition at line 86 of file encoding.py.
| robot.utils.encoding.CONSOLE_ENCODING = get_console_encoding() |
Definition at line 25 of file encoding.py.
| robot.utils.encoding.PYTHONIOENCODING = os.getenv('PYTHONIOENCODING') |
Definition at line 27 of file encoding.py.
| robot.utils.encoding.SYSTEM_ENCODING = get_system_encoding() |
Definition at line 26 of file encoding.py.