I actually ran into this exact problem once before. For the purposes of "SCP-3125" I wanted to make it so that readers couldn't just hit "View source" to see the hidden content of the page. At first I used a Vigenère cipher, which works fine on English text. But then, translation
-
-
Show this thread
-
Vigenère ciphers (of which Caeser ciphers such as ROT-13 are a special case) have no effect on Japanese text. So I needed to come up with something analogous which could be applied to all Unicode text
Show this thread -
But you can't just naïvely rotate Unicode code points. That rotation can lead to unassigned code points, or invalid ones. What about combining characters? Normalization of the output can cause data corruption. So can whitespace flattening
Show this thread -
In the end I used a dumb solution, which was to percent-encode the input and *then* apply the Vigenère cipher to the percent-encoded input. The result looks a little ridiculous, but it was definitely illegible and 100% reversible, which was the important part
Show this thread -
And while I'm at it, can everybody *please* remember to NFD-normalize your strings prior to ROT-13. "Naïveté" should become "Anv̈irgŕ", not "Anïirgé". Otherwise, if the encoded text does get normalized in transit, it'll decode incorrectly to "Nav̈vetŕ"
Show this thread -
-
You know what? Here's a ROT13 implementation which handles combining characters properly https://qntm.org/files/rot13/rot13.html …
Show this thread
End of conversation
New conversation -
-
-
…wait, that site is saying it should be pronounced "rote" (like in "rotate")? I've been pronouncing the "rot" in rot13 like rotting fruit. Have I been mispronouncing it all this time?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
qntm wtf
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.