Re: How to know if a file is a text file

2009-11-15 Thread Nobody
On Sat, 14 Nov 2009 17:02:29 +0100, Luca Fabbri wrote: I'm looking for a way to be able to load a generic file from the system and understand if he is plain text. The mimetype module has some nice methods, but for example it's not working for file without extension. Any suggestion? You

Re: How to know if a file is a text file

2009-11-15 Thread Chris Rebert
On Sun, Nov 15, 2009 at 4:06 AM, Nobody nob...@nowhere.com wrote: On Sat, 14 Nov 2009 17:02:29 +0100, Luca Fabbri wrote: I'm looking for a way to be able to load a generic file from the system and understand if he is plain text. The mimetype module has some nice methods, but for example it's

Re: How to know if a file is a text file

2009-11-15 Thread Luca
On Sat, Nov 14, 2009 at 6:51 PM, Philip Semanchuk phi...@semanchuk.com wrote: Hi Luca, You have to define what you mean by text file. It might seem obvious, but it's not. Do you mean just ASCII text? Or will you accept Unicode too? Unicode text can be more difficult to detect because you

Re: How to know if a file is a text file

2009-11-15 Thread Nobody
On Sun, 15 Nov 2009 04:34:10 -0800, Chris Rebert wrote: I'm looking for a way to be able to load a generic file from the system and understand if he is plain text. The mimetype module has some nice methods, but for example it's not working for file without extension. Any suggestion? You

Re: How to know if a file is a text file

2009-11-15 Thread Nobody
On Sun, 15 Nov 2009 13:49:54 +0100, Luca wrote: I was quite sure that this is not a very simple task. Right now search only inside ASCII encode is not enough for me (my native language is outside this encode :-) Checking every single byte can be a good solution... I can start using the

Re: How to know if a file is a text file

2009-11-14 Thread Philip Semanchuk
On Nov 14, 2009, at 11:02 AM, Luca Fabbri wrote: Hi all. I'm looking for a way to be able to load a generic file from the system and understand if he is plain text. The mimetype module has some nice methods, but for example it's not working for file without extension. Hi Luca, You have to