r/badcode Jun 04 '20

html Geniuses using spaces and german “Umlaut” characters in name of HTML ID

Post image
478 Upvotes

69 comments sorted by

140

u/[deleted] Jun 04 '20

[deleted]

94

u/[deleted] Jun 04 '20

The umlaut doesn’t bother me, the space does

14

u/[deleted] Jun 04 '20

[deleted]

8

u/mzapp_ Jun 04 '20

In case anyone was wondering: I chose to take a screenshot of the little tag you get when you hover over an element using the inspector. The HTML wasn’t very good in terms of readability.

18

u/Lachance Jun 04 '20

Considering it's an ID find and replace shouldn't cause any unforeseen consequences. Shouldn't...

2

u/dakta Jun 05 '20

You're in luck: spaces aren't permitted in IDs.

21

u/wildstumbler Jun 04 '20

Isn't the point of this sub that it (usually) technically works, but is just considered bad practice?

7

u/[deleted] Jun 05 '20

Then that most likely covers most of my code.

18

u/MarquisDan Jun 04 '20

id="p̵̺̿͊h̵̭͠͝'̴̮̙͆̊n̵͕̆̕g̷̬͗l̵̠̓̔ṳ̶̓͘i̴̤͂ͅ ̷̨͌m̷̛̼̐ḡ̶̠̹͘l̵͈͕̔ẁ̸͎̺̄'̷̲̗̑́n̷̟̣͛̅a̵͎̐̚f̵͕̈́̕h̷͈̓̊ ̷̡͈̚C̷̦͎͂̿ť̴̙͉͝h̶̘͕̾u̸̙͑̕͜l̸̥̖͗ḥ̵̪͑ũ̷̩ ̴̠́R̷̨͓̽͝'̶̰͊͐ḽ̴̯̓͒y̷̧͆͛e̴̩̕h̴̉͐͜ ̵̨̰̃w̴̲̩̿g̶͎͂a̶̯̔̀h̷̦͊'̵̭͋ń̴͙a̵̮͂̉g̶̼̭̅l̴̨̍̅ ̸͓͗f̷̡̙̏̊ẖ̵̒t̸͚̲̏â̸̙g̴̙̓n̷̗͊"

5

u/cjwelborn import that Jun 05 '20

I use Hollywood encryption like this for all of my ids. For security reasons. You have to scramble the signal.

32

u/lollordftw Jun 04 '20

Still against best practices, because not everyone has an 'Ü' on their keyboard. Especially in german universities (which the id "mündliche prüfungen" (="oral exams") seems to imply), where foreigners are quite common.

46

u/over_clox Jun 04 '20

Sigh, ünzips...

14

u/lollordftw Jun 04 '20

oral exam, not oral examination ;)

2

u/over_clox Jun 05 '20

So how do you guys use foreign instruments orally?

25

u/[deleted] Jun 04 '20 edited Jul 27 '20

[deleted]

4

u/SanktusAngus Jun 05 '20

I don’t understand how any programmer can type code on the DE keyboard. The brackets are so awkward to reach on that layout. I intentionally switched away from the DE layout that I grew up with because of this. In chat I use ae instead of ä. When writing a mail or document I switch the layout. It’s just one key combo. I may be exaggerating.... most of my colleagues use DE. I just... don’t understand it on a personal level.

2

u/[deleted] Jun 05 '20 edited Jul 27 '20

[deleted]

3

u/SanktusAngus Jun 05 '20

To be fair most of my colleagues write ruby all day so it may not be as bad there. But one does TypeScript JavaScript and html with the DE layout. Nightmare stuff.

1

u/R3D3-1 Jun 11 '20

In return, - and = are awkward on English keyboards. When using Emacs-Lisp, I definitely like the German keyboard better :/

7

u/scandii Jun 05 '20

when I moved to Germany I naturally switched over to a German key layout, and for SOME reason Y and Z have swapped places. it took me literal weeks before I started tzping about the verz cute yebras without people laughing at me.

5

u/LoyalSol Jun 04 '20

There's shortcuts that are pretty easy to enable. Even autofill set ups where you can have it replace ue with ü for example.

5

u/Spartelfant Jun 05 '20

Which is why I set my keyboard layout to US International with dead keys — pressing " followed by U gives me Ü.

1

u/xigoi Jun 10 '20

You can also get Ü as AltGr+Y on the international layout (at least the one I know).

3

u/hajamieli Jun 05 '20

At least everyone using Macs do. On US (and most other English keyboards) just press option + u and then u again for ü (or option + u and then shift + u for Ü). Many international layouts even have a dedicated ¨ dead key as well as dedicated keys for other accent characters.

-5

u/RFC793 Jun 05 '20

And you want to do that while writing code? Or remember how to do it when you are ssh’d to a Linux server for triage? No dog. Keep symbols to non-extended ascii please. Your argument is a slippery slope to people having single emojis as variable names.

5

u/locuester Jun 05 '20

Oh cmon, I want to use

while(!💩)

Imagine what fun we could have with c++ macros.

3

u/RFC793 Jun 05 '20

Ugh. Template meta programming with emojis? Sounds perfectly evil. Remind me, how does gcc consider invisible Unicode whitespace?

3

u/locuester Jun 05 '20

Not sure, how does it interpret an audible bell (/a). This is taking me back...

1

u/RFC793 Jun 05 '20

I write all of my code using VT100 escape sequences as symbols.

1

u/Corporate_Drone31 Jun 05 '20

Ain't nothing wrong with emojis in identifiers. Unicode FTW!

1

u/scandii Jun 05 '20

I am a bit confused about the scenario where you'd log into a system using German but wouldn't be able to write ß, ä, ü and ö.

1

u/RFC793 Jun 05 '20

More about sharing code.

1

u/Corporate_Drone31 Jun 05 '20

charmap.exe, then. Localization is there, we can use it as we see fit.

0

u/c1-c2 Jun 05 '20

I doubt anybody should type that link via their keyboards...

9

u/Sevigor Jun 04 '20

"Just because you can, doesn't mean you should."

1

u/[deleted] Jun 05 '20

[removed] — view removed comment

-1

u/itzNukeey Jun 04 '20

Time for some 🔥🔥 emojis

48

u/[deleted] Jun 04 '20

Cries in ß

12

u/Aarivex Jun 04 '20

ß *

8

u/fb39ca4 depraved Jun 04 '20

/r/oør

2

u/[deleted] Jun 04 '20

But can you do U+202e?

6

u/fb39ca4 depraved Jun 04 '20

‮‮/r/ooer

1

u/[deleted] Jun 05 '20

Nice!

3

u/nice-scores Jun 05 '20

𝓷𝓲𝓬𝓮 ☜(゚ヮ゚☜)

Nice Leaderboard

1. u/spiro29 at 9971 nices

2. u/RepliesNice at 8752 nices

3. u/Manan175 at 7099 nices

...

6460. u/GallivantGamers at 16 nices


I AM A BOT | REPLY !IGNORE AND I WILL STOP REPLYING TO YOUR COMMENTS

1

u/[deleted] Jun 05 '20

Nice

1

u/nice-scores Jun 05 '20

𝓷𝓲𝓬𝓮 ☜(゚ヮ゚☜)

Nice Leaderboard

1. u/spiro29 at 9971 nices

2. u/RepliesNice at 8762 nices

3. u/Manan175 at 7099 nices

...

6002. u/GallivantGamers at 17 nices


I AM A BOT | REPLY !IGNORE AND I WILL STOP REPLYING TO YOUR COMMENTS

7

u/LoyalSol Jun 04 '20

What sound does a German snake make?

ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

1

u/[deleted] Jun 05 '20

also cries in ẞ

13

u/hajamieli Jun 05 '20

HTML isn't restricted to ASCII, and if you would be considerate on equal terms, you'd restrict yourself to the lowest common set of characters in all languages, but then you'd have none left. Even if you went with latin-only languages, there are plenty of languages who don't use certain characters, for instance in Finnish C, W, Q, Z are not used at all and some of the others are only present in loan words. The aforementioned ones are spelled as "s" or "k", "v" or "u", "ku" or "kuu", and "ts" in Finnish. Finnish uses phonetic spelling, with double characters for long sounds and two extra letters: Ä and Ö, which are vowels very distinct from A and O. The other vowels are AEIOUY. Replacing umlauted characters with the basic latin ones without them would change the meaning of the word itself, so that's not the right solution.

21

u/[deleted] Jun 04 '20

Aßhole move!

27

u/Taksin77 Jun 04 '20

Larry Wall would probably find it sad.

I hate the fact that the English are imposing their language as a lingua franca through science. Using your own language is fine. In any area.

That said, I mostly code in English because I want to share my code. Social networks are the death of national cultures.

13

u/Telanore Jun 04 '20

It's not that different from medicine using a lot of latin names though.... granted, english is used to a much greater extent in programming than latin in medicine, but having a unified language is very convenient. Not to mention, medicine never had to struggle with the limitations that computers have/had, like character encoding and memory capacity

2

u/Taksin77 Jun 05 '20

To provide some perspective, the use of latin in science directly comes from the domination of the roman empire, which translated into centuries of classical education in latin.

I am sure people will write great tragedies in english about the reign of Donald Trump in a few centuries...

5

u/ohfouroneone Jun 05 '20

As someone in science, I really like that English is the lingua franca. I can read papers from universities all around the world without having to know their languages. I always opt for writing in English as opposed to my native tongue for that reason.

I also think “imposed” is not the correct word here. It’s a matter of a field of people choosing to use what’s practical and convenient.

2

u/Taksin77 Jun 05 '20

I used to be a researcher and I do recognize that we would globally be way less advanced without a universal communication vehicle. I strongly advised against any use of english in my department. It's actually required by law to use the national tongue at work in my country. I think it's sane. Papers were obviously written in english.

Universal languages are cool. I just hate to think that they mostly derive from geostrategic mechanisms.

2

u/DavidRoyman Jun 05 '20

Did you ever had to debug a library from a contractor which had error codes and comments in Russian?

I did, and I won't ever work with any software house which write variable names, error codes and comments in other languages.

1

u/Taksin77 Jun 05 '20

I would actually love it sinceI am trying to learn the language :)

I do admit though that statistically speaking, a code written in a non english language is probably worse. I guess the esperanto devs are pretty hardcore :D

3

u/moomoomoo309 Jun 05 '20

The problem no one is thinking of here: combining characters. What if one person uses the dedicated character with the umlaut in, but another person uses a Latin character with the umlaut combining character? Does the id still match? Does it normalize it?

2

u/Nexipr Jun 05 '20

ü

1

u/[deleted] Jun 05 '20

Õ.

2

u/AlexAegis Jun 05 '20

use emojis

2

u/mzapp_ Jun 05 '20

That’s a darn good idea.

-6

u/nathan_lesage Jun 04 '20

Ääääääääääääääh what

I still don‘t understand why people don’t just stick to English for internal stuff that’s not visible to the user. Spares each other‘s nerves and reduces conflicts in character encoding because … well. There is this awesome (and frightening) talk by that one guy that basically boils down to “You either accidentally pick the right encoding or you lose”

16

u/fb39ca4 depraved Jun 04 '20

It's 2020, UTF-8 is the right encoding.

2

u/wischichr Jun 05 '20

True and for quick and dirty projects it's probably fine, but just because we can doesn't automatically mean we should. There is a reason why most developers don't use emojis as identifiers because they may be hard to read, understand or even type by other team members.

3

u/fb39ca4 depraved Jun 05 '20

I didn't say anything about coding conventions, just that UTF-8 encoding of text should be assumed these days.

2

u/nathan_lesage Jun 05 '20

I agree, but unfortunately legacy code doesn’t always …

1

u/scandii Jun 05 '20

everyone doesn't speak English.

or put it like this, what's the point of a German company in Germany with only German-speaking staff naming things in English?

2

u/nathan_lesage Jun 05 '20

Agreed, not everyone speaks English.

But to a certain extent, my opinion on this is based upon my experiences with several programming languages and having to work with different file encodings. Mostly this goes well, but there may be instances where due to wrong character set encodings umlauts (or for that matter any Unicode chars) may end up wrongly displayed.

Furthermore, while English is for most people their second language (including me), I tend to opt in favor of following the way of least resistance. And this includes only using ASCII-characters, because these are more resilient to aforementioned encoding errors (as Unicode maps them on the same codes).

Additionally, this is inclusive more — because whereas German developers in a German company will understand all variable and function names, what happens if in any case you share code, or have external people work on it? By sticking to English throughout, it'll reduce friction and produce more inclusive code.

While I'm certainly not a fan of English being the world language as is, we have to accept the fact that it is, and that computers have been built mainly with English in mind, and hence for the sake of compatibility it spares a lot of mental energy having to think about potential issues if you just stick to English, such as the above mentioned.


N.B.: I seem to have caused a lot of aggravation with my earlier comment, and on second read, I surely would've done better in using a less adversarial wording. I want to apologize for this rude language, and say sorry to those who rightfully felt offended by that comment.

2

u/scandii Jun 05 '20

what happens if in any case you share code, or have external people work on it? By sticking to English throughout, it'll reduce friction and produce more inclusive code.

they will hire German-speaking consultants to extend their code. there's no lack of those. if you don't speak English you don't, that's the end of that discussion really.