473,668 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is unicode_escape broken?

Hi,

I am confused by unicode_escape functionality - it doesn't seem to
follow string_escape functionality.

I would expect that given the same string (or at least a non-unicode
and unicode string appropriately) that they would produce more or less
the same output, but:
"\t\\t".encode( 'string_escape' ) '\\t\\\\t' u"\t\\t".encode ('unicode_escap e') '\\t\\t'

(I would have expected "\\t\\\\t" )

and then round - tripping also seems to be broken for unicode_escape: "\t\\t".encode( 'string_escape' ).decode('strin g_escape') '\t\\t' u"\t\\t".encode ('unicode_escap e').decode('uni code_escape')

u'\t\t'

Python Version "Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310
32 bit (Intel)] on win32"

Thanks
Mark

Dec 13 '05 #1
1 2187
I also believe this is a bug.

Here's an even shorter demonstration of the behavior:
u"\\".encode("u nicode_escape") .decode("unicod e_escape")

Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeDecodeEr ror: 'unicodeescape' codec can't decode byte 0x5c in
position 0: \ at end of string

To report a bug, follow the directions at the bottom of this page:
http://www.python.org/2.4.2/bugs.html

To report a bug not listed above, always check the SourceForge Bug
Tracker[1] to see if they've already been reported. Use the bug tracker to
report new bugs. If you have a patch, please use the SourceForge Patch
Manager[2]. Please mention that you are reporting a bug in 2.4.2, and note
that you must have a SourceForge account and be logged in to submit a
bug report or patch (we require this in case we need more information
from you).

[1] http://sourceforge.net/bugs/?group_id=5470
[2] http://sourceforge.net/patch/?group_id=5470

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDn19oJd0 1MZaTXX0RArj/AJ0XG0bl+617gN3 dwG7/M4VkpZyePgCeLh/z
7mNsUDU1M7FqWU9 eA5COjlo=
=GQcK
-----END PGP SIGNATURE-----

Dec 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
12146
by: Frank de Bot | last post by:
Hi, occasionaly I find in my apache logs that fastcgi had a broken pipe error with php running as fastcgi. the logs are like this: -- > (32)Broken pipe: > FastCGI: comm with server /opt/guide/ppi.searchy.net/cgi-bin/php.fcgi" > aborted: write failed > FastCGI: incomplete
2
8614
by: Nigel King | last post by:
I have a problem with the logging module. It reports a Broken Pipe error after outputing to the log file occasionally (5%). This does not appear to happen on Mac OSX using current finked python (2.3.3) but does appear to occur on Python 2.3.4 running on a very old Redhat Linux xxxxx 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686. The actual logged error follows my signature. Note that "files used:-" has been sent to the file. From a...
2
3933
by: Dicky Cheng | last post by:
Hi, I am using .net remoting technology. I set up a .net remoting client and server in IIS. When the client calls the server, the server will run a long duration method (30-60seconds). I have a test on it that if the network broken at the time the client have already send the remoting request and waiting for the server, the client side will wait infinitely by default, even if i already set the executionTimeout to 90seconds in...
7
2256
by: Jacob | last post by:
Has anybody else encountered a problem when running your asp.net applications off your localhost and having broken image links? The weird thing is, the links aren't really broken. The reference is correct. And what's weirder that than, it will only do it sporadically. I can refresh the screen and those images that were once broken are now visible but some others may now be broken. Or sometimes they all work, sometimes none. This...
2
10296
by: aurora | last post by:
I have some unicode string with some characters encode using python notation like '\n' for LF. I need to convert that to the actual LF character. There is a 'unicode_escape' codec that seems to suit my purpose. >>> encoded = u'A\\nA' >>> decoded = encoded.decode('unicode_escape') >>> print len(decoded) 3 Note that both encoded and decoded are unicode string. I'm trying to use
4
3092
by: tt40 | last post by:
Anyone know how to prevent Access 2002 from automatically breaking all the incorrect joins in a query and then automatically saving the broken query? This is what I would call stupid design behaviour...Access takes your 'broken' query and auto saves it as what I call a 'corrupt' query... 1. Rename some BE tables and attributes 2. Open your FE 3. Open a query in design view that you know to now have broken names
64
3443
by: groups | last post by:
C# is an impressive language...but it seems to have one big limitation that, from a C++ background, seems unacceptable. Here's the problem: I have a third-party Document class. (This means I can't change the Document class.) I want to extend this (inherit from Document) as MyDocument, adding new events and application-specific methods and properties.
25
4675
by: Norman Diamond | last post by:
I think the current version of _vsnwprintf_s is broken, in ordinary Windows. I'm not completely sure yet but it looks like this breakage is worse than previously known Windows CE breakage of StringCchPrintf. For Windows CE breakage of StringCchPrintf, since the %S format died instead of converting ANSI to Unicode, a workaround was to call MultiByteToWideChar and then use the %s format. For ordinary Windows breakage of _vsnwprintf_s,...
8
1911
by: Steven D'Aprano | last post by:
According to the Python docs, once an iterator raises StopIteration, it should continue to raise StopIteration forever. Iterators that fail to behave in this fashion are deemed to be "broken": http://docs.python.org/lib/typeiter.html I don't understand the reasoning behind this. As I understand it, an iterator is something like a stream. There's no constraint that once a stream is empty it must remain empty forever.
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8374
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8890
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8791
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8575
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7398
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.