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

2008-03-07 Thread rmano
On Mar 4, 1:00 pm, NickC <[EMAIL PROTECTED]> wrote: > > Python 3.0a3+ (py3k:61229, Mar 4 2008, 21:38:15) > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 > Type "help", "copyright", "credits" or "license" for more information.>>> > r"\u" > '\\u' > >>> r"\uparrow" > '\\uparro

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

2008-03-04 Thread NickC
On Feb 26, 8:45 am, rmano <[EMAIL PROTECTED]> wrote: > BTW, 2to3.py should warn when a raw string (not unicode) with \u in > it, I think. > I tried it and it seems to ignore the problem... Python 3.0a3+ (py3k:61229, Mar 4 2008, 21:38:15) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)]

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

2008-02-25 Thread rmano
On Feb 25, 11:27 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Raw > > should be raw... > > Right. IMO, this is just a plain design mistake in the Python Unicode > handling. Unfortunately, there was discussion about this specific issue > in the past, and the proponent of the status quo alway

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

2008-02-25 Thread Martin v. Löwis
> Yes, I think I will do something like that, although... I really do > not understand why \x5c is not interpreted in a raw string but \u005c > is interpreted in a unicode raw string... is, well, not elegant. Raw > should be raw... Right. IMO, this is just a plain design mistake in the Python Uni

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

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

2008-02-25 Thread OKB (not okblacke)
Romano Giannetti wrote: > 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

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
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 Thinker
Romano Giannetti wrote: > 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 th

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

2008-02-25 Thread Diez B. Roggisch
Romano Giannetti wrote: > 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 tha

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