def myCalc(name,nameVal):
  if (name == nameVal):
    return 1
    return 0



This doesn't work with accentuated strings. (But works with unaccentuated strings). What can I do?

  • 1
    I hope this helps. – dassouki Oct 22 '14 at 12:48
  • @dassouki why would that help me? I don't see that. I hope is there some kind of library what can I use, for example "unidecode" in this script, but I could not find any example for doing that in field calculator. – greyline Oct 22 '14 at 12:52
  • This may help: gis.stackexchange.com/q/61598/115 – PolyGeo Oct 22 '14 at 12:57
  • Not really yet. – greyline Oct 22 '14 at 13:17
  • Not that the code you have is wrong, but you could shorten it by setting the return value at the start and in the if statement changing it as needed, then return the value. Saves an else and multiple returns. – recurvata Oct 22 '14 at 13:20

Put a u in front of the string so the interpreter knows it's Unicode.

myCalc(!Epulettipus!, u"Lakóépület")
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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