“A vicious circle of incompatibility”

A fun 16-minute video from PortalRunner with this premise:

This is an image file, containing a picture of my cat. But if I rename it to .MP4, it becomes a video file – also of my cat. If rename to .PDF, it becomes a text document containing the script for this video. It can also be a valid webpage, a .ZIP archive, or a PowerPoint presentation, all by simply changing the name. This kind of file is sometimes called a “polyglot” (although, usually that term refers to code that works in multiple programming languages).

This kind of a file is not something that you will realistically need, but it’s a fun look into various approaches to headers and structures of file formats – something we don’t usually get to think about a lot.

Buried inside the video is also an interesting digression: is the file extension just a method of delivering the file to the right application? If I rename .jpeg to .gif, and both are routed to Pixelmator, should Pixelmator do its best to detect it’s a JPEG file under the hood, or fail with a “this doesn’t look like a GIF file” message?

The web has a similar challenge in the form of MIME sniffing – “MIME” is sort of the web’s equivalent of extensions, “sniffing” means detecting the file from its contents alone, ignoring everything else – and that had some security considerations, as it allowed bad actors to sneak in some malicious code under the guise of something more innocuous… basically what the video is doing for fun, but now weaponized.

This is all pretty technical for this blog, but inside the Wikipedia entry for MIME sniffing is this passage that caught my attention:

[MIME sniffing is still used by some browsers. However,] by making sites which do not correctly assign MIME types to content appear to work correctly in those browsers, it fails to encourage the correct labeling of material, which in turn makes content sniffing necessary for these sites to work, creating a vicious circle of incompatibility with web standards and security best practices.

Decades before MIME sniffing, Jon Postel captured the essence of that line of thinking by coining Postel’s Law – “be conservative in what you send, be liberal in what you accept” – but as enticing as it is, that has challenges similar to the above quote:

A flaw can become entrenched as a de facto standard. Any implementation of the protocol is required to replicate the aberrant behavior, or it is not interoperable. […] Ensuring interoperability in this environment is often referred to as aiming to be ”bug-for-bug compatible”.

While Postel’s Law was about data flowing in and out of computer systems, the premise is to me a more evergreen design question, applicable to so many other things. Feeling “liberal in what you accept” can feel helpful, but can teach users bad habits and have bigger consequences. For any project where this applies, it’s worth asking: should we go out of our way to help the user even if they mess up, or should we be more rigid and teach them to follow the rules more strictly, as it will benefit them in the future?

The Command Line Interface Guidelines I linked to before had a great example of that:

You can ask if they want to run the suggested command, but don’t force it on them. For example:

$ heroku pss
› Warning: pss is not a heroku command.
Did you mean ps? [y/n]:

Rather than suggesting the corrected syntax, you might be tempted to just run it for them, as if they’d typed it right in the first place. Sometimes this is the right thing to do, but not always.

Firstly, invalid input doesn’t necessarily imply a simple typo—it can often mean the user has made a logical mistake, or misused a shell variable. Assuming what they meant can be dangerous, especially if the resulting action modifies state.

Secondly, be aware that if you change what the user typed, they won’t learn the correct syntax. In effect, you’re ruling that the way they typed it is valid and correct, and you’re committing to supporting that indefinitely. Be intentional in making that decision, and document both syntaxes.

text.makeup

I am generally not someone who cares much for easter eggs (unless they come with interesting stories), but John Gruber’s one-liner made me pause for an unexpected reason:

Joanna Stern explains why this emoji is correct today: 📅. (This one too: 📆)

I thought the two different calendars was some trickery, but the answer is simpler than that. I did not realize that, inexplicably, there are two distinct calendar emoji: one for calendar, and one for a tear-off calendar.

The way I learned about it was to use a tool I made a few years ago called text.makeup:

I thought this would be a nice opportunity to share it with you. If you’re debugging a string you don’t understand, or are just interested in learning about various Unicode or encoding secrets through playing (see the left sidebar!), it might be a fun thing to use.

I just updated it with the most recent emoji (and Unicode goodies) that will drop after September this year.

“If HEIC has no haters I’m dead.”

Over on Bluesky, Melanie Walsh asks:

Favorite and least favorite file formats? I’ll start.

Favorite: TXT
Least favorite: HEIC

The answers – both replies and quote posts – are really interesting because most of the time they’re not about inherent capabilities of each format, but:

  • how well supported it is in the general ecosystem?
  • how painful it was last time I used it?
  • who’s using it and for what?
  • if there is one app I use it with, do I like this app? (interesting in the context of PDFs which some people love, and others hate)

Of course, Walsh put a finger on the scale with her initial example, but HEIC stands out as a favorite least favorite. I understand this is mostly out of its limited support, raising a question whether Apple spent the right amount of time socializing and incentivizing its adoption – even on a Mac, you can’t escape blank stares the moment you drag it into many websites/web apps:

HEIC on the other hand, Apple’s way of making photos smaller and everything else more complicated than it needs to be.

By the way HEIC is when you drag a picture from your Notes app into your email, and then it laughs in your face and is like sorry, girl, I’m HEIC!! I don’t do things like that!!

I didn’t know I had a least favorite file format but yeah HEIC can fuck right off

Sweet fucking hell fuck heic into the sun

Reading the replies here makes me feel like I live in an oddly privileged bubble in an inverse of the usual meaning of privilege for being a poor Android-using mfer who has never seen a HEIC in their life and had to actually look that sh*t up.

Least favorite is a toss up between HEIC (WHICH NOBODY ASKED FOR, APPLE) and WEBP

Controversial but I hope everyone involved with HEIC only tastes soap instead of cilantro forever

I agree with this person that WebP is much better supported than it used to, but it sometimes takes one link in the chain – cough Google Docs cough – for you to avoid a format forever. And, those are always lagging indicators. If a format didn’t work once in an important flow, it might take many years before you come back:

all the people saying “webp” in the quotes might as well be fighting WW2 still. look for another grievance. please

Some other fun answers:

IF IT’S CALLED [C]OMMA [S]EPARATED [V]ALUES WHY DO I HAVE TO OPEN A WINDOW AND CHANGE THE DEFAULT DELIMITER OPTION FROM TAB TO COMMA ??!?!?!

Favorite: MP3 (invented piracy, patents all expired, doesn’t need an FPU)
Least favorite: DICOM (nightmarish metadata, too many possible image encodings, when it wants a 3D volume the solution is just “a bunch of files in a folder”, also IT IS A NETWORK PROTOCOL >:( )

Least fave: .R01, .R02, etc... – nothing needs to be split into multiple rar files! Please stop! The world has moved beyond this.

Least favorite: can I count those awful pointer doc types Google uses, like .gdoc and .gsheet

favorite: transparent PNG
least favorite: transparent PNG that is not really transparent but just a fuckin checkered background

I forgot about this meme:

For least fav I voted for GIF, having not only spent countless hours trying to make good-looking animated gifs that do not weigh tens of megabytes, look horrible, and cause performance issues… but also having worked on two different products (Medium and Figma) that had to swallow gifs made by others, and seeing engineers lose their minds peeking into their insides and how messy they were.

To be fair, GIF comes from the late 1980s, and simply outlived its purpose. It’s a fascinating format that literally deserves a book written about it: the messy patent wars, the pronunciation, the technical format and many surprises hiding inside, even the word “gifs” transcending the format itself to mean “short animated memes.”

To go back to the thread, a small pattern that I also encountered from time to time:

Least favorite: .md, specifically when it’s used for Sega Genesis game roms. There’s already a type of text file type called .md, so Windows tries to open them in notepad. Just call it .gen instead, nerd.

Favorite: TS, the one that opens in my IDE
Least Favorite: TS, the one that opens in Quicktime

Lastly, because of course someone had to do it:

Favorite: Gaylord Archival® Reinforced Acid Free Manilla
Least favorite: Office Depot Vertical Hanging Folders

Mailbag: The curious case of the disappearing Polish S

Even before the “remaster,” my essay about the Polish S bug was routinely discovered by Hacker News and other places, so I thought I would take a look at all the commentary over the years and summarize.

First, pragmatically, these are the lessons for any keyboard shortcut designer:

  • On Windows, AltGr (Right Alt) and Ctrl+Alt shortcuts are one and the same, and Right Alt and alphabetic keys are used for some languages to output regular accented letters. You should not prioritize Ctrl+Alt shortcuts anywhere your users write text.
  • On a Mac, ⌥ and most keys generate characters. They do so even on English layout for extra typographical flair, but particularly in other languages, regular accented letters might hide there. Note that these are not just letter keys, but also digits and other keys. You should not prioritize ⌥ shortcuts anywhere your users write text.

I couldn’t find a good image, so I made these two as an example. First is Mac’s American keyboard with ⌥ held. Second is Polish keyboard with ⌥ held, with Polish letters highlighted:

Jumping to the promised comments, I liked this story:

Outlook has a shortcut Alt+S to send the current e-mail. In Polish “Hello” is “Cześć”. When you acidentally have non-Polish locale enabled and write “Cześć” in Outlook - you send “Cze” as your whole e-mail.

“Cze” is a very informal greeting, sth like “Yo”. There has been thousands of such e-mails in Polish companies sent to people who really shouldn’t be greeted with “Yo.” :)

Here’s a little summary of other similar bugs. I verified some of them:

  • “Oh, that explains why I accidentally triggered Claude with Alt+Space, despite it being configured as Ctrl+Alt+Space.” Link
  • “Noticed similar issues with official Australian VISA / immigration pages. You can’t simply fill some forms with your email address using Finnish keyboard. Why? Because they block usage of AltGr button on their page. They also prevent using clipboard blocking copy paste option for that sign. User has to be smart enough to switch to US keyboard and then enter @ sign and then switch back. So this is nothing new, but it’s absolutely rude from part of the site designers to vandalize basic functionality like that. Normally @ is produced by AltGr+2.” Link
  • “In a similar fashion, you cannot type the capital letter Ł in Notion. You type the letter with ⇧⌥L on the Polish keyboard on a Mac. Notion uses the ⇧⌥L keyboard combo for its own purposes.” Link
  • “Medium learnt its lesson in 2015. Google still hasn’t and you cannot type Ś in Sheets, at least not on MacOS.” Link
  • “Meanwhile, in 2026 I suddenly cannot type capital Ś in Edge on Mac. I feel like I moved back in time 25 years or so.” Link
  • “I wonder if it is a similar reason why currently on MS Teams I can’t type the letter ń.” Link
  • “It’s just like the new Copilot 365. Every time I try to type Ć, Copilot pops up. I have to close the app constantly.” Link
  • “I had a similar issue when ASUS’s bloatware background service decided to bind something to both Alt+S and Alt+A globally. I have to keep it disabled or else I won’t be able to type ą, Ą, ś and Ś without using Caps Lock to work around the issue.” Link
  • “In an Nvidia overlay there is a shortcut Alt+Z. It’s pretty annoying because it triggers on both left and right Alt, so polish users cannot type letter ż without opening the overlay or rebinding it. Nvidia pls fix.” Link
  • “The very same bug used to be present in early Windows mobile GPU drivers - with global hotkeys making it impossible to enter Ł (with Intel GMA 950) and Ć (with ATI Catalyst). Being a Polish geek, I used to earn lots of free dinners from frustrated friends who were forced to copy-paste those letters on their brand new laptops. Funny how the same bug recurs in different types of software due to an obscure locale-dependent edge case - and it’s much less known than, for example, the Turkish dotted/​dotless I.” Link
  • “Installing KeePass used to silently disable ”ą” key (AltGr+A hotkey). KeePass broke system of every Polish user immediately after being installed.” Link

I’m sharing this for awareness. I believe many other languages/​writing systems also have this problem; the examples are lopsided toward Polish only because my original example was about Polish.

Lastly, I found this an interesting anecdote:

In Portugal we had a similar workaround in the early days of computers not supporting our alphabet properly. Like in Polish there are plenty of words that without diacritics get another completely unrelated meaning, e.g. caça vs caca, which you didn’t want the interpretation to be left to the receiver.

So tricks got invented, like adding additional letters for the missing diacritics, é becomes eh, è becomes he or eh as in the former case, the example above would be cac,a and so on. However it was still quite flexible, not everyone uses the same extension set.

I wouldn’t be surprised if every single language outside of English developed some sort of a way to cope and adjust to limitations of originally American-oriented computers. In my book, I wrote about Japanese and Turkish, and there is another book – The Chinese Typewriter – that spends a lot of time talking about this very issue for China.

If this subject is particularly interesting to you, venture out into the Hacker News waters to see more commentary: 2015, 2021, 2024, 2026.

“There seems to be a file that is just filled with undecipherable Morse.”

On April Fools in 2021, the popular xkcd comic ran Checkbox, which was a Morse code puzzle in disguise. (It’s interesting to see the community trying to figure out what it actually does.)

Engineer Max Goodhart built the front-end and wrote a summary of the whole project:

This year was a doozy. We specced and scrapped several different ideas in the months leading up to today. We finally settled on today’s concept just 3 days ago. The need to do something simple was a really useful constraint, and we leaned into the idea of making something primitive but deep.

The team seems to have had a lot of fun with it, including even JavaScript being encoded in Morse Code (the link in the blog post no longer works, but you can still see it on the Internet Archive).

Goodhart also wrote about the immense challenge of adjusting the Morse tapping speed to the user, which counterintuitively ended up needing… adjusting the user to the speed. But the best part is that the server communications used the Morse code in URLs, as well:

We took great pains to make the API for this project use morse code in the transport. If you take a look at the network inspector, you’ll notice that the URLs requested have morse code in them.

This worked for every combination of letters imaginable, with two oddly specific exceptions: a solitary E, and a solitary I.

I liked this description of what transpired next, which would have made me think I was going insane, too:

Then, an even stranger thing happened. I copied and pasted the correct URL into my browser and pressed Enter, and right before my eyes, it deleted the ”.” from the end of the URL and returned a different result.

I was delighted to discover an answer here, not only because in retrospect it’s such an obvious thing that was staring us all in the face for decades, but also because it has interesting URL construction consequences.

“A number of hidden problems in the naïve approach”

A fantastic 37-minute video by Nic Barker that explains ASCII, Unicode codepoints, and their relationship to UTF-8, UTF-16, and UTF-32.

I learned a lot, and I never thought I’d walk away from the video appreciating the craft of text encoding. Also, really good storytelling!