/    Sign up×
Community /Pin to ProfileBookmark

Correct File Names

Hi!

Is it ok to use underscores (that is, “_”) in a html file name?

I would prefer to name a file “chairs_blue.html” instead of “chairsblue.html.” Are there any issues or disadvantages in naming a file “chairs_blue.html” instead of “chairsblue.html?

Thank you, CowGirl!

to post a comment
HTML

8 Comments(s)

Copy linkTweet thisAlerts:
@abzOct 28.2006 — yes, using _ is fine. I often capitalise all but the first word of my files (eg. chairBlue) but thats not so great for web use.

It deson't really make all that much difference, so long as what you do, you do consistantly. otherwise you will never remember what if you have chair_blue, greenTable, ,purplelamp etc...
Copy linkTweet thisAlerts:
@the_treeOct 28.2006 — According the ye very olde standards for Uniform Resource Indicators:http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#unreserved

Characters that are allowed in a URI but do not have a reserved purpose are called unreserved. These include uppercase and lowercase letters, decimal digits, hyphen, period, underscore, and tilde.[/quote]
So it's okay as far as the Internet and the Web are concerned.

Weather the file systems are okay with it, I'll have to check... http://blogs.msdn.com/brian_dewey/archive/2004/01/19/60263.aspx

NTFS and the Posix subsystem have the most permissive definition of a "legal" name. The name may be up to 32,768 Unicode characters long.[/quote]
Well an underscore is Unicode character number 95, so it's alright so far. Can't think where to check for what characters FAT32 allows, but I'd just assume that you can use underscores in pretty much any case imaginable.
Copy linkTweet thisAlerts:
@CharlesOct 28.2006 — The way a nerd handles long identifier names tells much about the person.

Java and JavaScript follow the convention of using an upper case character to start the nextWord. Perl and PHP each us an underscore to separate the two, next_word. You can always spot a PHP programmer working with JavaScript and you can always spot a JavaScript programmer by the file names.

Myself, I find it unappealing when the conventions are mixed so I use both as the context requires. And outside the context of a programming language I use "-" as a separator. (Except that to avoid problems with caching, I'll include the revision date in [url=http://www.w3.org/TR/NOTE-datetime]W3C DTF[/url] and so I'll use "." characters on either side of the date.) It's sort of a convention with IDs in XML and it works well with file-names. I find the underscore a little_jarring.
Copy linkTweet thisAlerts:
@the_treeOct 28.2006 — It really doesn't tell you anything more than their programming habits. I don't buy into convention that much and I often tend towards the philosophy of: [I]if you need to define the system by which you organise your own stuff, you have to much stuff[/I].
Copy linkTweet thisAlerts:
@CowGirlauthorOct 29.2006 — To all those who replied, Thank you!
Copy linkTweet thisAlerts:
@ray326Oct 29.2006 — The biggest complaint a lot of programmers have with "_" is that it's shifted and a little out of the way, i.e. it's ever so slightly more trouble to type than camel case.
Copy linkTweet thisAlerts:
@CharlesOct 29.2006 — Camel case still requires the holding down of two keys and the ever lurking danger that "caps lock" might be hit. In cases where the hyphen character isn't a token separator,[i]id est[/i] outside of the program itself, that character is the elegant and easy solution.
Copy linkTweet thisAlerts:
@MstrBobOct 29.2006 — You know, I hadn't really thought of it until now, but you could probably tell a programmers language of choice by the conventions s/he follows. camelCase or underscore, indentations, capitalization rules and the like.

Generally speaking, though, either underscores or cameCase should be used in filenames. Spaces are absolutely taboo due to their inconsistent handling, and hyphens and + similarly, but to a lesser extent. Some real old guys still limit their file name lengths to 8 characters, but those guys are just crazy. ?
×

Success!

Help @CowGirl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...