My code:
logging.warning('FASE VALIDACIÓN TITULOS DE COLUMNAS DE DATOS NO SUPERADA. compruebe los nombres de los títulos de las columnas en datos.csv)')
Output in .log file:
WARNING:root:FASE VALIDACI�N TITULOS DE COLUMNAS DE DATOS NO SUPERADA. compruebe los nombres de los t�tulos de las columnas en datos.csv)
Then I tried this:
logging.basicConfig(filename=nombreFicheroLog, encoding="utf-8", level=logging.DEBUG)
But it does not work. Then I tried this one:
logging.warning(u'FASE VALIDACIÓN TITULOS DE COLUMNAS DE DATOS NO SUPERADA. compruebe los nombres de los títulos de las columnas en datos.csv)')
But the output is the same.
How I can encode the .log file to support UTF-8?
P.S. I'm using Python3.
uto a string in Python 3 doesn't do anything. Strings are unicode per default in Python 3 anyway.�character? Have you looked at it in a hex dump of that .log file? (Maybe it's just the log file viewer who is not displaying the utf 8 correctly.)