[LINUX] 'Ascii' codec can't encode characters in position xx-xx: ordinal not in range (128) when calling PHP → Python

I want to write a script in Python and call it from PHP. Check the operation of the Python side on the console, If you try to make a front with PHP and call it, this

'ascii' codec can't encode characters in position 28-32: ordinal not in range(128)

ascii? Does it work on the console? You can't change the locale

Try it with the python execution command

LC_ALL=\"ja_JP.utf8\" python test.py

It worked when I defined it as.

I don't know.

Thank you P.S. boss.

Recommended Posts

'Ascii' codec can't encode characters in position xx-xx: ordinal not in range (128) when calling PHP → Python
UnicodeDecodeError:'ascii' codec can't decode byte 0xa4 in position 0: ordinal not in range (128)
yum throws "UnicodeDecodeError:'ascii' codec can't decode byte 0xc3 in position 15: ordinal not in range (128)" error
When codec can't decode byte appears in python
Today's python error: UnicodeEncodeError:'ascii' codec can't encode characters
Today's python error: UnicodeEncodeError:'utf-8' codec can't encode characters
I was addicted to deploying GoogleCloudFunctions ('ascii' codec can't encode character u'\ u281b' in position 58 appears)
'shift_jis' codec can't encode character'\ uff0d' in position 0: resolution of illegal multibyte sequence