[ 
https://issues.apache.org/jira/browse/AIRFLOW-1144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15986286#comment-15986286
 ] 

Gerard Toonstra commented on AIRFLOW-1144:
------------------------------------------

Hi Sushant,

It sounds like you're mixing encoding settings. The psql client probably 
outputs in japanese encoding, but airflow expects everything to be in utf-8. 
You could try to force the client encoding of psql to utf-8 as well:

SET client_encoding = 'UTF8'; 

in a test script first to set the client encoding. If that works, I wouldn't go 
about to have that at the top of every file, but make this part of your 
environment. You can add this to either ~/.psqlrc , use an environment variable 
or let the client figure this out from LC_CTYPE. See the postgres docs for 
details. Please update this JIRA when you know more.

> Logging causes UnicodeEncodeError when using Japanese characters
> ----------------------------------------------------------------
>
>                 Key: AIRFLOW-1144
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1144
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: logging, worker
>    Affects Versions: 1.8.0
>            Reporter: Sushant Karki
>
> I am using the bash operator to pipe a sql dump to my database. Since, the 
> encoding of my psql client is Japanese, the output displays some Japanese 
> characters. Whenever the logger tries to log the output, it raises a 
> UnicodeEncodeError.
> Here are the details of the error.
> {code}
> Exception in thread Thread-1:
> Traceback (most recent call last):
>   File "/usr/lib64/python2.7/threading.py", line 813, in __bootstrap_inner
>     self.run()
>   File "/usr/lib64/python2.7/threading.py", line 766, in run
>     self.__target(*self.__args, **self.__kwargs)
>   File 
> "/home/karki/virtualenv/master/local/lib/python2.7/site-packages/airflow/task_runner/base_task_runner.py",
>  line 95, in _read_task_logs
>     self.logger.info('Subtask: {}'.format(line.rstrip('\n')))
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u884c' in 
> position 58: ordinal not in range(128)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to