Skip to content

Conversation

qiangxinglin
Copy link

@qiangxinglin qiangxinglin commented May 4, 2025

Submission Checklist

  • Run unit tests
  • Declare copyright holder and open-source license: see below

Summary

When run code in non-English system, jupyter would implicitly set encoding to 'utf-8', explicitly set the encoding here would make the behavior consistent.
Fix downstream bug facebook/prophet#2462

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):

myself

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

When run code in non-English system, jupyter would implicitly set encoding to 'utf-8', explicitly set the encoding here would make the behavior consistent.
@@ -47,6 +48,7 @@ def do_command(
stderr=subprocess.STDOUT, # avoid buffer overflow
env=os.environ,
universal_newlines=True,
encoding=locale.getdefaultlocale()[1],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's too bad encoding='locale' and locale.getencoding() are only available on newer versions. I think locale.getpreferredencoding(False) is the best option for older versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants