I'm new to python and trying to write a python script using the field calculator in ArcMap for a specific field in an attribute table that will calculate and place the values in the other field. My Pre-logic Script Code:

def calcVal(inVal):
    values = {
    if inVal in values.keys():
        return values[inVal]

Character “A” in 1st condition ("BABBBBBBBB":1) is non english character. Field calculator does not recognize this text value. Coding is UTF8.

Is a special symbols in python with who I can substitute this non-english character, like % or *?

Or, it is possible to configure this code to recognize UTF8 coding?

1 Answer 1


For how to deal with non-ASCII characters in python, have a look at string encoding. Frankly, this is a pain in the rear in python 2, made much easier in python 3. You can mitigate this somewhat by using unicode literals.

Notice, however, that to save a non-ASCII character to any column in a table, that layer will need to be set to whichever encoding you're using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.