Skip to content

Item 10, 3rd Edition, from learning.oreilly.com: determine default encoding using incorrect function name... #122

Description

@KjellSwedin

The lesson here is that you should check the default encoding on your system (using python3 -c 'import locale; print(locale.getpreferred-encoding())') to understand how it differs from your expectations.

should be:

The lesson here is that you should check the default encoding on your system (using python3 -c 'import locale; print(locale.getpreferredencoding())') to understand how it differs from your expectations.


As written:
kjells:notebooks$ python3 -c 'import locale; print(locale.getpreferred-encoding())'
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'locale' has no attribute 'getpreferred'

With change:
kjells:notebooks$ python3 -c 'import locale; print(locale.getpreferredencoding())'
UTF-8

kjells:notebooks$ python3 --version
Python 3.12.3

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions