Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Making a string, file-safe (file-encode??)

Reply
Thread Tools

Making a string, file-safe (file-encode??)

 
 
Gordon Beaton
Guest
Posts: n/a
 
      06-18-2008
On Wed, 18 Jun 2008 12:41:10 +0200, Hendrik Maryns wrote:
> I?ve been using names like ?(?y)(y?--).mona? and ?E1 x (E1 y (& (& (>+ x
> y) (cat x NF)) (cat y PX))).gta? without problems, on Linux.


I like to use filenames like "-rf ~ &;" followed by random strings.
Keeps my users on their toes.

/gordon

--
 
Reply With Quote
 
 
 
 
Tom Anderson
Guest
Posts: n/a
 
      06-18-2008
On Tue, 17 Jun 2008, Eric Sosman wrote:

> Tom Anderson wrote:
>> On Tue, 17 Jun 2008, Eric Sosman wrote:
>>
>>> wrote:
>>>> I was wondering if there was a quick way to ensure that a filename is
>>>> a safe.
>>>>
>>>> What I mean is that if I am creating a file from a string variable, I
>>>> want to ensure that the file will actually be able to be created. So
>>>> if it contains a "?", then clearly I would want to eliminate it.
>>>
>>> The "alphabets" for file names vary from system to system,
>>> and there are systems on which '?' is perfectly legal. So your
>>> "clearly" isn't really all that clear ...

>>
>> Oh come on, this is ridiculous.

>
> I surmise you've never needed to write code for multiple
> file systems.
>
>> The only safe and sane thing to do is to target the common set of valid
>> filenames - so exclude ?, /, \, , *, ", etc. Surely this is blindingly
>> obvious? This is not a complicated question, it's quite clear what the OP
>> wants to know, and you're not helping anyone by making a mountain out of a
>> molehill.

>
> Very well, then: "All portable file names shall consist
> of one to six decimal digits or upper-case English letters, one
> period, and zero to three decimal digits or upper-case English
> letters." If you're content with this as a least common denominator, you're
> all set.


Ah, i had indeed forgotten that there were filesystems like that!

Okay, lowest common denominator of filesystems in widespread use on
computers at present. Pre-LFN FAT32 and non-Joliet ISO 9660 don't qualify.

Although, is LFNless FAT32 used on memory cards for cameras?

>>> In general, though, you can't guarantee that a file will be creatable
>>> just by examining its name. On one widespread system,
>>> "D:\\README.TXT" is a perfectly valid file name but you are unlikely
>>> to succeed in creating a new file on a CD-ROM ... Or you may lack
>>> permission to create files in some folders, or the file system may be
>>> full, or ...

>>
>> True. And completely unconnected to what the OP asked.

>
> He asked for a file name that would quote ensure that the file will
> actually be able to be created end quote.


It was pretty clear to me from his post that that wasn't what he was
asking.

tom

--
The future is still out there, somewhere.
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      06-18-2008
On Tue, 17 Jun 2008 20:41:47 GMT, Roedy Green
<> wrote, quoted or indirectly quoted
someone who said :

>see http://mindprod.com/jgloss/filenames.html for some thoughts on the
>problem


I have revised the essay based on some thoughts from Eric Sosman.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      06-19-2008
On Wed, 18 Jun 2008, Lew wrote:

> Eric Sosman wrote:
>>> He asked for a file name that would quote ensure that the file will
>>> actually be able to be created end quote.

>
> Tom Anderson wrote:
>> It was pretty clear to me from his post that that wasn't what he was
>> asking.

>
> The OP asked, in the first post:
>> What I mean is that if I am creating a file from a string variable,
>> I want to ensure that the file will actually be able to be created.

>
> Eric gave an exact quote, and even said, "quote ... end quote". How was
> it "pretty clear to [you] that that wasn't what [the OP] was asking",
> when it was word for word exactly what they asked?


Because the OP, i believe, expressed himself imperfectly, and the text
quoted did not accurately represent his query. If you examine the rest of
his post, that is clear. Cherry-picking sentences and interpreting them
literally is a useful rhetorical tool, but it doesn't help answer
questions.

tom

--
IT'S OVER NINE THOUSAND!!!
 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      06-19-2008
On Thu, 19 Jun 2008, Eric Sosman wrote:

> Tom Anderson wrote:
>> On Wed, 18 Jun 2008, Lew wrote:
>>
>>> Eric Sosman wrote:
>>>>> He asked for a file name that would quote ensure that the file will
>>>>> actually be able to be created end quote.
>>>
>>> Tom Anderson wrote:
>>>> It was pretty clear to me from his post that that wasn't what he was
>>>> asking.
>>>
>>> The OP asked, in the first post:
>>>> What I mean is that if I am creating a file from a string variable,
>>>> I want to ensure that the file will actually be able to be created.
>>>
>>> Eric gave an exact quote, and even said, "quote ... end quote". How was
>>> it "pretty clear to [you] that that wasn't what [the OP] was asking", when
>>> it was word for word exactly what they asked?

>>
>> Because the OP, i believe, expressed himself imperfectly, and the text
>> quoted did not accurately represent his query. If you examine the rest of
>> his post, that is clear. Cherry-picking sentences and interpreting them
>> literally is a useful rhetorical tool, but it doesn't help answer
>> questions.

>
> The original post contained three count them three paragraphs. The
> first was introductory, sort of a title for the rest. The second had
> two sentences, one whose operative portion was the material I quoted,
> and a second making it clear that the poster was thinking of lexical
> tests. The third made an analogy with lexical manipulation of URLs.


Right, so it was obvious that he was thinking of lexical tests, then?

> You've called me ridiculous,


Eric, i don't think i called you ridiculous, and i certainly didn't mean
to imply that. I apologise if it came across like that. I called something
you said ridiculous, and i think it was.

> you've accused me of twisting the O.P.'s words, and I'm starting to find
> your style of argumentation lacking in, well, style.


Again, my apologies. I'll try and be more entertaining in future.

tom

--
Throwin' Lyle's liquor away is like pickin' a fight with a meat packing
plant! -- Ray Smuckles
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: A fresh new approach to making making online Fakename Computer Information 0 11-18-2005 02:10 AM
Is making a print server wireless possible? Warren Bryant Wireless Networking 5 01-25-2005 01:20 AM
Making new Flavors : Making a custom transferhandler for and drop applications ebby83@gmail.com Java 5 01-12-2005 11:10 AM
Base Station making buzzing sound =?Utf-8?B?Szc3N25pZ2h0?= Wireless Networking 1 12-16-2004 01:15 PM
making two computers connect =?Utf-8?B?ZG9kZHk=?= Wireless Networking 2 09-15-2004 10:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57