Live data from Hacker News

I'm “still afraid to use spaces in file names” years old

twitter.com

571–580 of 817 posts

Re: I'm “still afraid to use spaces in file names” years old

#571

I work on a complex desktop application, and it's been astounding the number of bugs that have appeared over the years triggered by spaces and other unusual characters in file names. If you do anything with subprocesses or path processing, it's absurdly easy to hit in a thousand different ways, over and over again. Pro tip: rename your development directory (or even better: the workspace path in CI) to put a space an…

Late '90s I worked on Java software that got installed on several Unix platforms, including Linux for IBM mainframes. When you deal with the default en/de-coding of Unicode to EBCDIC you never have trouble with Java byte encodings ever again.

Re: I'm “still afraid to use spaces in file names” years old

#572
post #533

Spaces in filenames were a mistake to begin with. Spaces are used to separate parameters in the command line. There's also no real need for filenames to support spaces.

The filename belongs to the user. Therefore, it is incumbent on the computer to adapt, not the other way around.

Re: I'm “still afraid to use spaces in file names” years old

#573
post #5

Slightly off topic but I find myself stuck at being "please for the love of god don't use spaces in git branch names" old. Anno dazumal this might not even have been an issue and I'm just cargo culting.

And on that topic, git branches are case sensitive but windows filesystem API isn't. Git branches are materialized on the filesystem as files and directories.

Yep, I recently got bit by this, someone checked in a branch named something like "xy", Windows was unhappy. I think this is a git bug: git should escape these names for the native platform.

https://stackoverflow.com/questions/1976007/what-characters-...

Re: I'm “still afraid to use spaces in file names” years old

#574
post #408

Earlier quoted context omitted.

Using the W functions has been the advice from Microsoft's documentation for ages. But people still use the A functions because they're easier, especially when writing cross-platform software since Windows is the only major OS that made the unfortunate choice of having the base character type 16 bits wide. Fortunately the future of the Windows API does look better since Microsoft has now added proper UTF-8 support si…

> since Windows is the only major OS that made the unfortunate choice of having the base character type 16 bits wide Apple OSes use something they call "unichar" inside NSStrings. I'm not 100% sure what it is, but it feels like it's the same 16-bit wide character.

It's possible! It seemed like a sensible choice back in the early 90s when the answer to making a system for global use was UCS-2. I know Java was another one that went with that decision.

Re: I'm “still afraid to use spaces in file names” years old

#576

Earlier quoted context omitted.

This goes for most instances of user input. Timestamps is the other common one people get wrong. I've even seen programs that pass around timestamps as strings in multiple formats and as integers (Unix time).

As a programming noob, I'm wondering what would be the better way to pass or return a unix time value as opposed to an integer?

If it's being serialized, consider fully qualified iso8601.

Re: I'm “still afraid to use spaces in file names” years old

#577

Earlier quoted context omitted.

> By the way: what's your beef with en dashes? Of all the changes in that list, removing the character that doesn't appear on a standard keyboard seems like the least controversial...

A better question might be "how did it get there in the first place?"

Presume all inputs are hostile.

Whether people or processes, something is likely to introduce the character at some point.

Re: I'm “still afraid to use spaces in file names” years old

#578

Earlier quoted context omitted.

> By the way: what's your beef with en dashes? Of all the changes in that list, removing the character that doesn't appear on a standard keyboard seems like the least controversial...

A better question might be "how did it get there in the first place?"

Sw which converts -- and __ on the fly. Same sw converts quote pairs "for your convenience"

Re: I'm “still afraid to use spaces in file names” years old

#579

Earlier quoted context omitted.

> FWIW, and it should be food for thought, every single Git repository in the world contains a pre-commit hook sample (disabled by default but it's there) that enforces that every committed file in the repo is named using a subset of ASCII characters. I use Git for documents too, not only code. Why shouldn't I use my native language?

Tab completion don’t work well for languages that require IME. That is one reason why I don’t.

IME == Input method editor?

https://en.wikipedia.org/wiki/Input_method

Re: I'm “still afraid to use spaces in file names” years old

#580
post #516

Earlier quoted context omitted.

Early on in my Linux-using-life I made the mistake of deleting /etc. That was a learning experience like no other :)

Since Live CDs/Flash drives were invented, I wouldn't worry about this stuff any longer. Certainly have your personal files in a centralized location and backed up first. Probably the easiest way to experiment these days is to create a VM and make snapshot, then start knocking down walls, just to see when and where the house collapses. Then revert and try something new.

There's a computer game that deletes random files when you make a mistake or lose.

There could be a competition!

Post reply on HN