Live data from Hacker News

I couldn't debug the code because of my name

mikolaj-kaminski.com

211–220 of 300 posts

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

#211

In CS, most algorithms assume an ASCII character set. I wonder if there's any string-related algorithms that completely break (functionally or complexity wise) when given UTF-16 or UTF-8 character sets

> In CS, most algorithms assume an ASCII character set.

They most certainly do not. E.g., a Turing machine assumes an alphabet Γ which is a set of some characters and is defined no further, as any exact definition is meaningless to the theory. (I.e., the algorithm is generic over any alphabet.) The alphabet need not even be text; e.g., for a Turing machine, the set of all octets suffices.

Even for something like Levenshtein distance, the only real requirement of the algorithm is that the abstract "characters" implement equality testing. For Unicode text, I'd start with graphemes, and then look for counter examples.

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

#212

Earlier quoted context omitted.

This is exactly why I hate the way Python3 handles Unicode. EVERY language should _try_ to handle Unicode such that if a data sequence were valid before it remains valid after. NONE should ever FORCE validation, since sometimes, like in the article's case, the correct answer is GIGO. Just pass it through and hope it continues to work. Sometimes the error is trying to enforce that validation.

How is this Python's fault? It's not like the `docker-compose` file would have worked any better if it silently replaced one of the volumes with an inaccessible file. Instead, you'd just get a failure from the Windows filesystem API when you tried to access or create a file at "C:\\Users\\Miko�aj\\AppData\\Local\\JetBrains\\Rider2021.2\\log\\DebuggerWorker\\\", right?

Not sure about Windows, but on a real operating system that's:

  $ ln -sT Mikołaj/ Miko�aj
That certainly isn't good, but it is

> would have worked any better

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

#213

Fun fact: If you have the exclamation mark (!) in your Windows username, Java will think it's the jar separator and `getResourceAsStream` will refuse to work. This broke many people's Minecraft installation over the years. The bug in question [0] was reported in 2001 and remains unsolved 20 years later. [0] https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4523159

Classic java

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

#214
post #209
post #172

Earlier quoted context omitted.

I believe that library / service is called UTF-8. These days everything should be stored as bare UTF-8 data (or utf8mb4 if you're MySQL) and presented without anything else. Don't parse it, don't slice-and-dice it, don't prepend or append titles or honorifics or suffixes, don't make assumptions about length or content beyond "must be > 0 as a whole" and DEFINITELY don't use it as an identifier. Treat it as a non-uniq…

Not good enough, thanks to Han unification - if you do that you'll mangle Japanese names.

"Mangle" is an exaggeration. Japanese names will look correct after Han unification both to Japanese people on a Japanese computer and to Chinese people on a Chinese computer. (All other combinations fail.)

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

#215
post #110

Earlier quoted context omitted.

> Can Ł have an alternative representation? Nope. Neither can ź, ć, ś, ą or ę. You can, and people do write them as z, c, s, a and e when writing in a restriced character set, but that is not 'correct' and is not a bijection, ie. „półka” and „polka” mean two different things. There's also the case of technically-same-sounding-especially-recently ż/rz and ó/u (whose replacement would let you get rid of two 'non standa…

I do find this sort of stuff fascinating and also faintly frustrating but of course my mother tongue is (in)famous for being a bit loose at first sight. According to one of my employees (Polish) Ł sounds roughly like w as in win or water but not as in what. A quick read of this: https://en.wikipedia.org/wiki/%C5%81 doesn't help too much. Does enforcing Ł instead of say w cause your written language to fail in some wa…

I think I just learned that some dialects/accents don't pronounce the w in water and the w in what the same way.

What's the difference?

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

#216

When I first installed Windows 7 like ten years ago, I entered my Russian name in Cyrillic. When I saw that the system created a directory with exactly that name under `C:\Users\` I immediately scanned the internet for a way to rename it and done just that. I don't want to know how much mess like that in a story I thus had successfully escaped. NB: the method is still the same, it's a second (not accepted) answer her…

This is sad though. You shouldn't have to change who you are for a computer program.

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

#217
Some years ago I used the + feature in my gmail address. e.g. myname+ycombinator@gmail.com to track down which service is giving away my email address. It happened more than once that I could not log in anymore at some point because they started to disallow the + character in email addresses. I also got phone calls from some companies complaining that i misspelled my email address because there was their company name in it.

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

#219
post #209
post #172

Earlier quoted context omitted.

I believe that library / service is called UTF-8. These days everything should be stored as bare UTF-8 data (or utf8mb4 if you're MySQL) and presented without anything else. Don't parse it, don't slice-and-dice it, don't prepend or append titles or honorifics or suffixes, don't make assumptions about length or content beyond "must be > 0 as a whole" and DEFINITELY don't use it as an identifier. Treat it as a non-uniq…

Not good enough, thanks to Han unification - if you do that you'll mangle Japanese names.

TIL, https://en.wikipedia.org/wiki/Han_unification#Examples_of_la...

It looks like there's no general solution possible with Han unification. If you have any two of ZH and JA and KO and VI in a page, you will fail to display one of them correctly for certain characters unless (as in that wiki page) you add a LANG attribute for each element they are contained within.

Personally, I would use the browser's language or user locale to set the page language and give up. Then in Japan the local (Japanese) names would look fine, and same for China, Korea and Vietnam. Local consistency versus complicated perfection (tracking the input language as well as tokens and using them everywhere), and I could blame the browser for doing poorly at its impossible job.

One possible "perfect" fix would be to store the token and $token as well. The only place the non-wrapped version would be used is plaintext email or SMS, either of which are beyond lost causes for other reasons. Doing it with an embedded SPAN tag presents its own problems with sanitization, as well as guaranteeing it's always wrong if the input language was specified incorrectly when the token was populated, versus as above where it would be corrected to the local-optimal version if the user locale overrides it.

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

#220

Fun fact: If you have the exclamation mark (!) in your Windows username, Java will think it's the jar separator and `getResourceAsStream` will refuse to work. This broke many people's Minecraft installation over the years. The bug in question [0] was reported in 2001 and remains unsolved 20 years later. [0] https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4523159

I find the very idea of putting an exclamation mark on one's username and not expecting eventual problems to be quite curious.
Post reply on HN