News for hackers. Stuff that matters.
Re:A popular but wrong way to convert a string to uppercase ... by vardump on Tuesday October 08, 2024 @05:51AM (#41775451)
Here's an example. Hypothetically say you want to build an HTML parser.

You might encounter tags like <html>, <HTML>, <Html>, etc., but you want to perform a hash table lookup.

So first you're going to normalize to either lower- or uppercase.

Re:A popular but wrong way to convert a string to uppercase ... by Muromec on Tuesday October 08, 2024 @06:16AM (#41775642)
But but, I want to have a custom web component and register it under my own name, which can only be properly written in Ukrainian Cyrillic. How dare you not let me have it.
Re:A popular but wrong way to convert a string to uppercase ... by inexcf on Tuesday October 08, 2024 @08:30AM (#41776614)
Ah, i see, we disagree on what is "human language". An abbreviation like HTML and it's different capitalisations to me sound a lot like a feature of human language.
Re:A popular but wrong way to convert a string to uppercase ... by recursive on Tuesday October 08, 2024 @02:24PM (#41780264)
Is this a serious argument? Humans don't directly use HTML to communicate with each other. It's a document markup language rendered by user agents, developed against a specification.
Re:A popular but wrong way to convert a string to uppercase ... by tannhaeuser on Tuesday October 08, 2024 @05:04PM (#41781806)
Markup languages and SGML in particular absolutely are designed for digital text communication by humans and to be written using plain text editors; it's kindof the entire point of avoiding binary data constructs.

And to GP, SGML/HTML actually has a facility to define uppercasing rules beyond ASCII, namely the LCNMSTRT, UCNMSTRT, LCNMCHAR, UCNMCHAR options in the SYNTAX NAMING section in the SGML declaration introduced in the "Extended Naming Rules" revision of ISO 8879 (SGML std, cf. https://sgmljs.net/docs/sgmlrefman.html). Like basically everything else on this level, these rules are still used by HTML 5 to this date, and in particular, that while elements names can contain arbitrary characters, only those in the IRV (ASCII) get case-folded for canonization.

Re:A popular but wrong way to convert a string to uppercase ... by recursive on Tuesday October 08, 2024 @07:58PM (#41783073)
HTML is a text-based medium. But that doesn't make it a human language. Some human languages are not text-based. And some text is not a human language.

ANSI C was designed to be written by humans using a plain text editor. That doesn't make it a human language.

Re:A popular but wrong way to convert a string to uppercase ... by ARandumGuy on Tuesday October 08, 2024 @02:45PM (#41780449)
Converting string case is almost never something you want to do for text that's displayed to the end user, but there are many situations where you need to do it internally. Generally when the spec is case insensitive, but you still need to verify or organize things using string comparison.