Using non-ASCII characters
To use non-ASCII characters, Python requires explicit encoding and decoding of strings into Unicode. In SPSS Modeler, Python scripts are assumed to be encoded in UTF-8, which is a standard Unicode encoding that supports non-ASCII characters. The following script will compile because the Python compiler has been set to UTF-8 by SPSS Modeler.
However, the resulting node has an incorrect label.
The label is incorrect because the string literal itself has been converted to an ASCII string by Python.
Python allows Unicode string literals to be specified by adding
u character prefix before the string literal:
This will create a Unicode string and the label will be appear correctly.
Using Python and Unicode is a large topic that's beyond the scope of this document. Many books and online resources are available that cover this topic in great detail.