Hi,
while writing some LaTeX preprocessing code, I stumbled into this problem: (I
have a -*- coding: utf-8 -*- line, obviously)
s = ur"añado $\uparrow$"
Which gave an error because the \u escape is interpreted in raw unicode strings,
too. So I found that the only way to solve this is to write
Thinker branda.to> writes:
>
>
> > s = ur"añado $\uparrow$"
> >
> > Which gave an error because the \u escape is interpreted in raw
> > unicode strings, too. So I found that the only way to solve this is
> > to write:
> >
> > s = unicode(r"añado $\uparrow$", "utf-8")
> >
> > or
> >
> > s = ur"
> unicode(r"\uparrow", "utf-8") will break... sigh.
>
Moreover, I checked with 2to3.py, and it say (similar case):
-ok_preamble = unicode(r"""
+ok_preamble = str(r"""
\usepackage[utf8]{inputenc}
\begin{document}
Añadidos:
""", "utf-8")
which AFAIK will give an error for the \u in \usepackag
On Feb 25, 6:03 pm, "OKB (not okblacke)"
<[EMAIL PROTECTED]> wrote:
>
> I too encountered this problem, in the same situation (making
> strings that contain LaTeX commands). One possibility is to separate
> out just the bit that has the \u, and use string juxtaposition to attach
> it to th