Get encoding that should be used for printing strings .. warning:: Falls back to ASCII, so that output is most likely to be displayed correctly.
()
| 37 | |
| 38 | |
| 39 | def get_preferred_output_encoding(): |
| 40 | '''Get encoding that should be used for printing strings |
| 41 | |
| 42 | .. warning:: |
| 43 | Falls back to ASCII, so that output is most likely to be displayed |
| 44 | correctly. |
| 45 | ''' |
| 46 | if hasattr(locale, 'LC_MESSAGES'): |
| 47 | return ( |
| 48 | locale.getlocale(locale.LC_MESSAGES)[1] |
| 49 | or locale.getlocale()[1] |
| 50 | or 'ascii' |
| 51 | ) |
| 52 | |
| 53 | return ( |
| 54 | locale.getlocale()[1] |
| 55 | or 'ascii' |
| 56 | ) |
| 57 | |
| 58 | |
| 59 | def get_preferred_input_encoding(): |
no outgoing calls
no test coverage detected