Re: Saving (unusual) linux filenames

2010-09-01 Thread Albert van der Horst
In article , Grant Edwards wrote: >On 2010-08-31, MRAB wrote: >> On 31/08/2010 17:58, Grant Edwards wrote: >>> On 2010-08-31, MRAB wrote: On 31/08/2010 15:49, amfr...@web.de wrote: > Hi, > > i have a script that reads and writes linux paths in a file. I save the > path (as

Re: Saving (unusual) linux filenames

2010-08-31 Thread Nobody
On Tue, 31 Aug 2010 18:49:33 +, Grant Edwards wrote: >> How many filenames contain control characters? > > How many filenames contain ","? Not many, Unless you only ever deal with "Unix folk", it's not /that/ uncommon to encounter filenames which are essentially complete sentences, punctuat

Re: Saving (unusual) linux filenames

2010-08-31 Thread Alan Meyer
On 8/31/2010 2:33 PM, Nobody wrote: ... FWIW, my usual solution is URL-encoding (i.e. replacing any "awkward" character by a "%" followed by two hex digits representing the byte's value). It has the advantage that you can extend the set of bytes which need encoding as needed without having to ch

Re: Saving (unusual) linux filenames

2010-08-31 Thread AmFreak
Thanks for all the nice answers! The normal thing to do is to escape the delimiter when it appears in data. There are lots of plenty of escaping standards to choose from, and some of them (e.g. the one used for URLs) are already present in various bits of Python's standard library. The CSV mo

Re: Saving (unusual) linux filenames

2010-08-31 Thread Stefan Schwarzer
Hi Grant, On 2010-08-31 20:49, Grant Edwards wrote: > How many filenames contain ","? CVS repository files end with ,v . However, just let's agree that nobody uses CVS anymore. :-) > Not many, but the OP wants his > program to be bulletproof. Can't fault him for that. What about using the csv

Re: Saving (unusual) linux filenames

2010-08-31 Thread Arnaud Delobelle
amfr...@web.de writes: > Hi, > > i have a script that reads and writes linux paths in a file. I save > the path (as unicode) with 2 other variables. I save them seperated by > "," and the "packets" by newlines. So my file looks like this: > path1, var1A, var1B > path2, var2A, var2B > path3, var3A

Re: Saving (unusual) linux filenames

2010-08-31 Thread MRAB
On 31/08/2010 19:33, Nobody wrote: On Tue, 31 Aug 2010 18:13:44 +0100, MRAB wrote: this works for "normal" paths but as soon as i have a path that does include a "," it breaks. The problem now is that (afaik) linux allows every char (aside from "/" and null) to be used in filenames. The only so

Re: Saving (unusual) linux filenames

2010-08-31 Thread Grant Edwards
On 2010-08-31, MRAB wrote: > On 31/08/2010 17:58, Grant Edwards wrote: >> On 2010-08-31, MRAB wrote: >>> On 31/08/2010 15:49, amfr...@web.de wrote: Hi, i have a script that reads and writes linux paths in a file. I save the path (as unicode) with 2 other variables. I save them

Re: Saving (unusual) linux filenames

2010-08-31 Thread Nobody
On Tue, 31 Aug 2010 18:13:44 +0100, MRAB wrote: this works for "normal" paths but as soon as i have a path that does include a "," it breaks. The problem now is that (afaik) linux allows every char (aside from "/" and null) to be used in filenames. The only solution i can think

Re: Saving (unusual) linux filenames

2010-08-31 Thread Albert Hopkins
On Tue, 2010-08-31 at 16:49 +0200, amfr...@web.de wrote: > i have a script that reads and writes linux paths in a file. I save > the > path (as unicode) with 2 other variables. I save them seperated by "," > and > the "packets" by newlines. So my file looks like this: > path1, var1A, var1B > pa

Re: Saving (unusual) linux filenames

2010-08-31 Thread MRAB
On 31/08/2010 17:58, Grant Edwards wrote: On 2010-08-31, MRAB wrote: On 31/08/2010 15:49, amfr...@web.de wrote: Hi, i have a script that reads and writes linux paths in a file. I save the path (as unicode) with 2 other variables. I save them seperated by "," and the "packets" by newlines. So

Re: Saving (unusual) linux filenames

2010-08-31 Thread Grant Edwards
On 2010-08-31, MRAB wrote: > On 31/08/2010 15:49, amfr...@web.de wrote: >> Hi, >> >> i have a script that reads and writes linux paths in a file. I save the >> path (as unicode) with 2 other variables. I save them seperated by "," >> and the "packets" by newlines. So my file looks like this: >> pa

Re: Saving (unusual) linux filenames

2010-08-31 Thread Jeremy Sanders
amfr...@web.de wrote: > i have a script that reads and writes linux paths in a file. I save the > path (as unicode) with 2 other variables. I save them seperated by "," and > the "packets" by newlines. So my file looks like this: > path1, var1A, var1B > path2, var2A, var2B > path3, var3A, var3B I

Re: Saving (unusual) linux filenames

2010-08-31 Thread MRAB
On 31/08/2010 15:49, amfr...@web.de wrote: Hi, i have a script that reads and writes linux paths in a file. I save the path (as unicode) with 2 other variables. I save them seperated by "," and the "packets" by newlines. So my file looks like this: path1, var1A, var1B path2, var2A, var2B path3,

Re: Saving (unusual) linux filenames

2010-08-31 Thread Grant Edwards
On 2010-08-31, amfr...@web.de wrote: > Hi, > > i have a script that reads and writes linux paths in a file. I save the > path (as unicode) with 2 other variables. I save them seperated by "," and > the "packets" by newlines. So my file looks like this: > path1, var1A, var1B > path2, var2A, var

Saving (unusual) linux filenames

2010-08-31 Thread AmFreak
Hi, i have a script that reads and writes linux paths in a file. I save the path (as unicode) with 2 other variables. I save them seperated by "," and the "packets" by newlines. So my file looks like this: path1, var1A, var1B path2, var2A, var2B path3, var3A, var3B this works for "norm