valid URL's - file names ?

B

Bob

Is it legit to have a URL/file name that starts with a number
like "4x2.gif" ? I'd be interested in comments for URL's (i.e.
I want to meet the spec as well as be platform compatible)
 
J

Jukka K. Korpela

Bob said:
Is it legit to have a URL/file name that starts with a number
like "4x2.gif" ?

Yes, there's nothing to prevent that. Check the URL specifications if
in doubt.
 
R

Richard

Bob said:
Is it legit to have a URL/file name that starts with a number
like "4x2.gif" ? I'd be interested in comments for URL's (i.e.
I want to meet the spec as well as be platform compatible)


Who cares? we have domain names that use 1-800 don't we?
I've seen all kinds of numbers in the url's.

Google image search results.
Searched images for 4x2.gif. Results 1 - 20 of about 837.

Welcome to the club.
 
H

Hunter

Bob said:
Is it legit to have a URL/file name that starts with a number
like "4x2.gif" ? I'd be interested in comments for URL's (i.e.
I want to meet the spec as well as be platform compatible)

Bob - yes - it's Ok to hae number in file names.

The rest of your post makes very little sense - I think you need to go back
to the drawing board.
Why do you have url/file name ? They have nowt to do with each other.
Why are you talking about platforms ? Whose platform ? The client ? The
server ? What difference does it make ? I guess maybe you mean
non-alphanumeric characters or something ?

This from the unix man:

Filenames
Filenames can be up to 255 characters long and can contain upper and lower
case characters, numbers, and special characters.
Examples:

a.. money
b.. lost+found
c.. Eeap.01.91
d.. Money
The above are all unique and valid filenames. Note that UNIX is very case
sensitive.

Alternatively - if you are on windoze they ever allow spaces (although
highly NOT recommended).

david
 
T

Toby A Inkster

Bob said:
Is it legit to have a URL/file name that starts with a number
like "4x2.gif" ?

A better file name might be just "4x2" -- that way you can switch to a
different format when you want, without needing to worry about updating
any pages that refer to it.
 
L

Leif K-Brooks

Toby said:
A better file name might be just "4x2" -- that way you can switch to a
different format when you want, without needing to worry about updating
any pages that refer to it.

But be sure to make your server send the correct MIME type.
 
B

Bob

Alternatively - if you are on windoze they ever allow spaces (although
highly NOT recommended).

Yes David, that was my point. I know that there are some odd
things allowed by MS-windows... and as long as everyone uses
the same OS for everything, it works. I don't want to do anything
that would "work" today but not meet the spec since I might find
a server OS, or browser enforcing the spec tomorrow and run into
problems.
 
T

Toby A Inkster

Hunter said:
This from the unix man:

Filenames can be up to 255 characters long and can contain upper and
lower case characters, numbers, and special characters.

Alternatively - if you are on windoze they ever allow spaces (although
highly NOT recommended).

FYI, Unix allows spaces in file names too. In general, Unix file names are
far more flexible than Windows ones (try creating a file called "CON" in
Windows!)

Unix file names can contain a range of characters not allowed on Windows:
asterisks, question marks, reverse solidus, colons, even new line
characters!
 
R

rf

Unix file names can contain a range of characters not allowed on Windows:
asterisks, question marks, reverse solidus, colons, even new line
characters!

Er, the latter would be for multi-line files then?

Cheers
Richard.
 
T

Toby A Inkster

rf said:
Er, the latter would be for multi-line files then?

I don't know what you mean by multi-line files. Most non-binary files
contain more than one line of text.

It is pretty hard to create a file with a new line character in it (you
can't just open up OpenOffice and save one -- it won't let you) but here
is a script illustrating that it can be done.

============================================
#!/usr/bin/perl

$filename = "line one\nline two.txt";
open(FILE, ">$filename");
print FILE 'Testing';
close(FILE);
============================================

This will create a file called:

line one
line two.txt

If you try to look at it using the "ls" command, ls gets confused and
prints out a question mark instead of the new line character. However the
"find" command will let you see that it really does have a new line
character in it.

To delete:

rm -i line\ one?line\ two.txt
 
L

Leif K-Brooks

Toby said:
This will create a file called:

line one
line two.txt

To delete:

rm -i line\ one?line\ two.txt


Interesting. If I create a file which is really called "line one?line
two.txt", rm prompts for both of them and calls the one with the new
line "line one\nline two.txt".
 
T

Toby A Inkster

Leif said:
Interesting. If I create a file which is really called "line one?line
two.txt", rm prompts for both of them

This is expected.In the "rm" command above, the ? is a wildcard and can
match any character, including newline ioor the question mark itself.
and calls the one with the new
line "line one\nline two.txt".

This is unusual I guess, but is in keeping with the fact that programs in
general don't seem to have a consistant way of printing the names of files
with a new line character in them in a consistent way. (e.g. ls uses a ?,
find uses a real new line, rm uses a c-style \n)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top