Embedding a literal "\u" in a unicode raw string.

2008-02-25 Thread Romano Giannetti
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

Re: Embedding a literal "\u" in a unicode raw string.

2008-02-25 Thread Romano Giannetti
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"

Re: Embedding a literal "\u" in a unicode raw string.

2008-02-25 Thread romano . giannetti
> 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

Re: Embedding a literal "\u" in a unicode raw string.

2008-02-25 Thread romano . giannetti
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