Processing.py-Bugs icon indicating copy to clipboard operation
Processing.py-Bugs copied to clipboard

Issue with non-ascii character support: non-ascii characters stop script and give a misleading error message, no non-ascii support in console

Open hjhilden opened this issue 1 year ago • 1 comments

If you input something like this in the IDE, the script will halt with a misleading error message about a missing parenthesis:

metsäkanat = 2000
print(metsäkanat)
image

Additionally, if you print a string with non-ascii characters, the console displays them wrongly:

print('Bösendorfer')
Bösendorfer

Tested on MacOS Monterey 12.5, Processing 4.3

hjhilden avatar Aug 03 '24 11:08 hjhilden

Cheers, @hjhilden !

Processing Python mode is based on Python 2 that can't handle non-ascii identifiers (names for variables, functions and etc.).

But you can have Unicode strings using the u prefix like this: print(u'Bösendorfer') .

I must warn you that Python mode is very precarious on Processing 4.X, it will mostly fail silently, unable to offer even the basic error messages, like NameError or TypeError. If you really want to use it, stick to Processing 3.5.4.

You could try https://py5coding.org, an actively maintained Python + Processing framework that that is based on Python 3!

villares avatar Aug 03 '24 14:08 villares