I’m trying to create hebrew strings but get syntax errors. It works in the IDLE shell but not in Pydev.
Here’s what I’ve tried so far:
s = 'מחרוזת בעברית' #works in the shell only
s = u'מחרוזת בעברית' #doesn't work at all
s = unicode("מחרוזת בעברית", "UTF-8") #also doesn't work at all
I get a syntax error: Non-UTF-8 code starting with ‘\xee’.
What does it mean and what shall I do to create hebrew strings?
Does your source file start with a
# -*- coding: utf-8 -*-line? Is your file actually encoded as utf-8 (and not some other encoding)?It’s supposed to work (the first line, other lines are not valid Python 3).