You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/01/11 03:48:52 UTC

[GitHub] mik-laj commented on a change in pull request #4474: [AIRFLOW-3439] Decode logs with 'utf-8'

mik-laj commented on a change in pull request #4474: [AIRFLOW-3439] Decode logs with  'utf-8'
URL: https://github.com/apache/airflow/pull/4474#discussion_r246997088
 
 

 ##########
 File path: airflow/utils/log/gcs_task_handler.py
 ##########
 @@ -129,7 +129,7 @@ def gcs_read(self, remote_log_location):
         :type remote_log_location: str (path)
         """
         bkt, blob = self.parse_gcs_url(remote_log_location)
-        return self.hook.download(bkt, blob).decode()
+        return self.hook.download(bkt, blob).decode('utf-8')
 
 Review comment:
   > So .decode('utf-8') is no difference from .decode().
   I have a different opinion.  Airflow support Python 2.7, 3.6=> ([Source](https://github.com/apache/airflow/blob/master/setup.py#L424))
   
   In documentation for Python 2.7, you can read a fragment:
   > Python’s default encoding is the ‘ascii’ encoding.
   Source: https://docs.python.org/2/howto/unicode.html
   
   It is also worth quoting another fragment
   > str.decode([encoding[, errors]])
   > Decodes the string using the codec registered for encoding. encoding defaults to the default string encoding.
   
   Taking into account the quotations above, the change proposed here changes the behavior of the program.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services