1

I have a node app that calls a spawn python process like so:

const python = spawn('python3', ['python/rimas_definitivas.py', input]);

the input variable comes from a form in the browser, and it usually has special caracters, like "á", "õ", ... in the python script the variable is read like this:

variable= sys.argv[1]

when the input doesn't have any special caracters the program runs fine, but when it does it doesnt work. also, i find these prints very strange, and they could be related to the problem:

for the input world "língua":

>>>variable= sys.argv[1]
>>>print(variable)
língua
>>>print([variable, ])
['l\udcc3\udcadngua']

the second input shouldn't be ['língua']?

It maybe has to do with utf-8/unicode, but i'm a begginer and I really don't know what to do...

0 Answers0