On Wed, Apr 21, 2010 at 2:29 AM, <f...@slick.airforce-one.org> wrote: >> Change your string literals to unicode by adding the u-prefix and you should >> be OK. > > Thanks, it solved the problem... for a while! > > I need now to know if s[i] gives the next byte or the next character, > when I scan the string s. I've googled pages about python and unicode, > but didn't find a solution to that. I scan the string read from the > file char by char to construct s, but now get the same error when just > trying 'print s'.
Assuming s = fichierLaTeX.read() as from your code snippet, the next character. When in doubt, check what `type(s)` is; if it's <type 'str'>, indices are in bytes; if it's <type 'unicode'>, indices are in code points. Please give the full stack traceback for your error. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list