Live data from Hacker News

I couldn't debug the code because of my name

mikolaj-kaminski.com

11–20 of 300 posts

Re: I couldn't debug the code because of my name

#13
post #6

What’s wrong with just writing it as Mikolaj? It’s not like it’s a kanji or something.

From the article:

The first idea was to change the username to one that does not contain Polish characters. It turned out that Windows does not rename the user’s folder when changing the username. Manually renaming the folder was not an option. This way I could corrupt my profile in the system.

The end of the article is about how to change the directory where the temporary files go to one not under the user folder.

Re: I couldn't debug the code because of my name

#18
post #2

It's somewhat common to see videogames issue a patch shortly after release where they fix crashes due to non-ASCII Windows usernames or non-English locales. I'm not sure what the root cause of the confusion is, other than text strings being hard in general.

It's easy to think the answer is "just UTF-8 everything" but unfortunately the long and twisty history of filesystems means that's not the correct answer, and the "correct answer" is really hard to write down quickly.

If you never display the filename, the answer is to treat existing filenames as bags of bytes, but that breaks down as soon as you need to display them, or if you need to manipulate them by appending unicode to them, in which case you have to decide on an encoding.

Unicode encodings tend to mangle non-Unicode values because they're specified to replace whatever they can't understand with a particular Unicode character, usually represented as a diamond with an inverted ? inside of it.

There's some obscure solutions to this problem, like https://simonsapin.github.io/wtf-8/ (which includes discussion of the 16 bit encodings you need for Windows), but I haven't seen broad support for them. You need a deliberately "noncompliant" encoding/decoding system that doesn't replace unknown characters with replacement characters. Fortunately, compliant systems are becoming more and more popular and available. Unfortunately, that can make file name handling harder than when you had a non-Unicode-compliant handling system for your strings.

Re: I couldn't debug the code because of my name

#19

And yet it's one of the simplest things to add non-ASCII chars to your tests to validate their handling. It's like not testing if your calculate application can handle negative numbers or decimals.

In fact it's trivial to generate a text file of all valid Unicode code points and use that as input to unit tests.
Post reply on HN