[Python-bugs-list] [ python-Bugs-437158 ] null char in string processing
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 29 Jun 2001 11:24:57 -0700
Bugs item #437158, was opened at 2001-06-28 11:41
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=437158&group_id=5470
Category: None
>Group: Not a Bug
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Vadim Suvorov (xxx-bad)
Assigned to: Nobody/Anonymous (nobody)
Summary: null char in string processing
Initial Comment:
The following program was excuted with different
results in several environments:
Windows ME:
s = 8 <straaaaaa>
< straaaaaa >
Windows NT: expected result
s = 8 <str >
< str >
Sun Solaris 8:
s = 8 <str>
< str >
In all cases, the length and contents of file "s" was
as expected, equal to s string.
s = "str\0\0\0\0\0"
print "s = ", len(s), "<" + s + ">"
print "<", str(s), ">"
f = open("s", "wb")
f.write(s)
f.close()
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2001-06-29 11:24
Message:
Logged In: YES
user_id=31435
Thanks for following up! In much of the world, the only
characters "safe" to display (or print) across all
available platforms are those characters c such that
32 <= ord(c) < 128
That is, the printable ASCII characters. Go beyond that
and it depends on all sorts of platform stuff, like the
display drivers, the terminals, available fonts, locale
settings, etc.
----------------------------------------------------------------------
Comment By: Vadim Suvorov (xxx-bad)
Date: 2001-06-29 07:47
Message:
Logged In: YES
user_id=85081
I was able to confirm your opinion. This is the effect of
terminal - I was thrown off by "a" as substitution for
unprintable character. Sorry, and thank you
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2001-06-28 12:57
Message:
Logged In: YES
user_id=31435
What does this have to do with Python? That is, Python has
no control over how your terminal displays non-printable
characters.
----------------------------------------------------------------------
Comment By: Vadim Suvorov (xxx-bad)
Date: 2001-06-28 11:56
Message:
Logged In: YES
user_id=85081
Oops. Forgot: Python v. 2.1
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=437158&group_id=5470