uranusjr commented on a change in pull request #17965:
URL: https://github.com/apache/airflow/pull/17965#discussion_r700831719



##########
File path: airflow/utils/log/file_task_handler.py
##########
@@ -116,7 +116,7 @@ def _read(self, ti, try_number, metadata=None):
 
         if os.path.exists(location):
             try:
-                with open(location) as file:
+                with open(location, encoding="utf-8") as file:

Review comment:
       Maybe we should do `error="replace"` or something so a log written in 
another encoding can still be partially read. I’m suspecting this input-output 
encoding mismatch only happens on Python 3.7+, when Python starts automatically 
coerce the default legacy C to UTC-8 ([PEP 
538](https://www.python.org/dev/peps/pep-0538/)). If this is the cause, setting 
`utf-8` here is a correct move, but we should still provide a fallback for 
weird platforms that need/want to use a platform-specific encoding. Perhaps a 
new config to explicitly set what encoding to use here?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to