1

`

pre-logic:
def myCalc(name,nameVal):
  if (name == nameVal):
    return 1
  else:
    return 0

var_name=
myCalc(!Epulettipus!,"Lakóépület")

`

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

5
  • 1
    I hope this helps.
    – dassouki
    Commented Oct 22, 2014 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
    Commented Oct 22, 2014 at 12:52
  • This may help: gis.stackexchange.com/q/61598/115
    – PolyGeo
    Commented Oct 22, 2014 at 12:57
  • Not really yet.
    – greyline
    Commented Oct 22, 2014 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
    Commented Oct 22, 2014 at 13:20

1 Answer 1

5

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

myCalc(!Epulettipus!, u"Lakóépület")

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.