Supports locale-specified encoding for rcfile.#3575
Supports locale-specified encoding for rcfile.#3575mdboom merged 1 commit intomatplotlib:masterfrom frutiger:locale_encoded_rcfile
Conversation
This commit fixes issue #1317. The locale for the encoding is obtained from the Python `locale` module, which can be specified by the `LANG` environment variable. This was tested by adding a test rc file encoded in UTF-32-BE, and testing that it decoded correctly.
There was a problem hiding this comment.
I think this will end up changing the rcParams, which may cause subsequent tests to fail if they rely on the rcParams being a certain thing. We may have to test lower down by calling _open_file_or_url directly.
There was a problem hiding this comment.
Testing the module by invoking a "private" method is something I'd prefer not to do.
It looks to me like rc_params_from_file returns a new RcParams object every time, and I don't see them sharing any global state. If you are still concerned, would del rc['timezone'] be enough to remove the configuration I've added?
There was a problem hiding this comment.
Sorry, my bad. You're right -- the global rcParams isn't updated in this case. This seems fine as-is.
|
Thanks. This looks good! |
Supports locale-specified encoding for rcfile.
This commit fixes issue #1317. The locale for the encoding is obtained from
the Python
localemodule, which can be specified by theLANGenvironmentvariable.
This was tested by adding a test rc file encoded in UTF-32-BE, and testing that
it decoded correctly.