[Python-Dev] PEP 383 and GUI libraries

2009-05-03 Thread Jim Jewett
(sent only to python-dev, as I am not a subscriber of tahoe-dev) Zooko wrote: > [Tahoe] currently uses utf-8 for its internal storage (note: nothing to > do with reading or writing files from external sources -- only for > storing filenames in the decentralized storage system which is > accessed

Re: [Python-Dev] PEP 383 and GUI libraries

2009-05-02 Thread Zooko O'Whielacronx
[cross-posting to python-dev and tahoe-dev] On Fri, May 1, 2009 at 8:12 PM, James Y Knight wrote: > > If I were designing a new system such as this, I'd probably just go for > utf8b *always*. Ah, this would be a very tempting possibility -- abandon all unix users who are slow to embrace our utf-

Re: [Python-Dev] PEP 383 and GUI libraries

2009-05-01 Thread James Y Knight
On May 1, 2009, at 9:42 PM, Zooko O'Whielacronx wrote: Yep, I reversed the order of encode() and decode(). However, my whole statement was utterly wrong and shows that I still didn't fully get it yet. I have flip-flopped again and currently think that PEP 383 is useless for this use case and th

Re: [Python-Dev] PEP 383 and GUI libraries

2009-05-01 Thread Zooko O'Whielacronx
Folks: Being new to the use of gmail, I accidentally sent the following only to MvL and not to the list. He promptly replied with a helpful counterexample showing that my design can suffer collisions. :-) Regards, Zooko On Fri, May 1, 2009 at 10:38 AM, "Martin v. Löwis" wrote: >> >> Require

Re: [Python-Dev] PEP 383 and GUI libraries

2009-05-01 Thread Cameron Simpson
On 01May2009 18:38, Martin v. L?wis wrote: | > Okay, I am wrong about this. Having a flag to remember whether I had to | > fall back to the utf-8b trick is one method to implement my requirement, | > but my actual requirement is this: | > | > Requirement: either the unicode string or the bytes a

Re: [Python-Dev] PEP 383 and GUI libraries

2009-05-01 Thread Terry Reedy
Zooko O'Whielacronx wrote: Following-up to my own post to correct a major error: Is it true that srcbytes.encode(srcencoding, 'python-escape').decode('utf-8', 'python-escape') will always produce srcbytes ? That is my Requirement If you start with bytes, decode with utf-8b to unicode (possi

Re: [Python-Dev] PEP 383 and GUI libraries

2009-05-01 Thread Martin v. Löwis
> Okay, I am wrong about this. Having a flag to remember whether I had to > fall back to the utf-8b trick is one method to implement my requirement, > but my actual requirement is this: > > Requirement: either the unicode string or the bytes are faithfully > transmitted from one system to another

Re: [Python-Dev] PEP 383 and GUI libraries

2009-05-01 Thread MRAB
Zooko O'Whielacronx wrote: Following-up to my own post to correct a major error: On Thu, Apr 30, 2009 at 11:44 PM, Zooko O'Whielacronx wrote: Folks: My use case (Tahoe-LAFS [1]) requires that I am *able* to read arbitrary binary names from the filesystem and store them so that I can regenera

Re: [Python-Dev] PEP 383 and GUI libraries

2009-05-01 Thread Zooko O'Whielacronx
Following-up to my own post to correct a major error: On Thu, Apr 30, 2009 at 11:44 PM, Zooko O'Whielacronx wrote: > Folks: > > My use case (Tahoe-LAFS [1]) requires that I am *able* to read arbitrary > binary names from the filesystem and store them so that I can regenerate > the same byte stri

Re: [Python-Dev] PEP 383 and GUI libraries

2009-05-01 Thread R. David Murray
On Thu, 30 Apr 2009 at 23:44, Zooko O'Whielacronx wrote: Would it be possible for Python unicode objects to have a flag indicating whether the 'python-escape' error handler was present? That Unless I'm misunderstanding something, couldn't you implement what you need by looking in a given strin

Re: [Python-Dev] PEP 383 and GUI libraries

2009-05-01 Thread Michael Foord
Zooko O'Whielacronx wrote: [snip...] Would it be possible for Python unicode objects to have a flag indicating whether the 'python-escape' error handler was present? That would serve the same purpose as my "failed_decode" flag above, and would basically allow me to use the Python APIs directory

Re: [Python-Dev] PEP 383 and GUI libraries

2009-04-30 Thread Zooko O'Whielacronx
Folks: My use case (Tahoe-LAFS [1]) requires that I am *able* to read arbitrary binary names from the filesystem and store them so that I can regenerate the same byte string later, but it also requires that I *know* whether what I got was a valid string in the expected encoding (which might be utf

Re: [Python-Dev] PEP 383 and GUI libraries

2009-04-30 Thread Mike Klaas
On 30-Apr-09, at 7:39 AM, Guido van Rossum wrote: FWIW, I'm in agreement with this PEP (i.e. its status is now Accepted). Martin, you can update the PEP and start the implementation. +1 Kudos to Martin for seeing this through with (imo) considerable patience and dignity. -Mike __

Re: [Python-Dev] PEP 383 and GUI libraries

2009-04-30 Thread Guido van Rossum
FWIW, I'm in agreement with this PEP (i.e. its status is now Accepted). Martin, you can update the PEP and start the implementation. On Thu, Apr 30, 2009 at 2:12 AM, "Martin v. Löwis" wrote: >> Did you use a name with other characters?  Were they displayed?  Both >> before and after the surrogate

Re: [Python-Dev] PEP 383 and GUI libraries

2009-04-30 Thread Martin v. Löwis
> Did you use a name with other characters? Were they displayed? Both > before and after the surrogates? Yes, yes, and yes (IOW, I put the surrogate in the middle). > Did you use one or three half surrogates, to produce the three crossed > boxes? Only one, and it produced three boxes - probabl

Re: [Python-Dev] PEP 383 and GUI libraries

2009-04-30 Thread Glenn Linderman
On approximately 4/30/2009 1:48 AM, came the following characters from the keyboard of Martin v. Löwis: I checked how GUI libraries deal with half surrogates. In pygtk, a warning gets issued to the console /tmp/helloworld.py:71: PangoWarning: Invalid UTF-8 string passed to pango_layout_set_text(

[Python-Dev] PEP 383 and GUI libraries

2009-04-30 Thread Martin v. Löwis
I checked how GUI libraries deal with half surrogates. In pygtk, a warning gets issued to the console /tmp/helloworld.py:71: PangoWarning: Invalid UTF-8 string passed to pango_layout_set_text() self.window.show() and then the widget contains three crossed boxes. wxpython (in its wxgtk version)