I have a python script that works very well on Archlinux, both from shell and a php page (using passthru() or shell_exec() )
This script prints some messages in french (with accented letters : é à è)
ex: print("Connexion à la base de données MySQL....")
I'm now using debian, everything works perfectly but this script.
no problem from shell : it works as usual.
But if I launch the script from a php page : error ! In Apache error.log I can see a message from Python that clearly indicates that Python can't encode "à" to ascii
So, why is Python using ascii encoding when launched from apache, and not when launched from shell ? Is there a way to force apache or Python to use UTF8 when the communicates ?
PS : Debian and Archlinux LOCALE are the same : UTF8
PS2: my script begin with
# -*- coding: Utf-8 -*-
PS3 : my text editor is configured for saving UTF-8 files
HTML page produced by php are UTF-8 (via meta tags)
I add a Default_charset= utf8 in php.ini (existed in Archlinux, not in Debian)
I try to add .encode('utf-8') to my text messages... No more errors, but it's not readable when displayed in HTML page (it displays something \x08)
I spent a lot of time in trying to solve this problem but I can't.... I need some help.