Instead of using a spoiler-hiding toggle, Masto should have a built-in rot13 (example: here ) function which allows you to scramble both outgoing toots, AND apply the shift to tweets you see in timelines.
Rot13 is a spoiler- or secret-hiding convention common in the communities which currently use Mastodon. It has, I think, a lot of character, and would allow us to hide and send spoiler-ized info without attaching additional data to a toot.
The problem is it only works for the Latin alphabet. Any language with different letters needs a different system.
I threw together a ROT* cypher which will work for any script, and is identical to ROT13 for ASCII Latin, which you can test here: https://marrus-sh.github.io/rotstar/
Basically, I just collected which Unicode characters were letters from LineBreaks.txt
in the Unicode Character Database and did a length/2
shift over each contiguous block. (For odd-lengthed blocks, the last letter in the block is left out.) Punctuation and other characters (importantly, characters regarding text direction and variation selectors) are left untouched鈥攐nly letter characters are affected.
The cypher results won't necessarily make a whole lot of conceptual sense in many languages鈥攊t might be a mess of capitals and lower-case, for example, depending on how Unicode broke up the blocks鈥攂ut it is functional and tweaking could always happen in the future.
I don't have a strong opinion on whether ROT13 gets implemented into Mastodon or not, but this should at least keep the option open.
EDIT: Probably worth mentioning that the example above only works on characters in the U+0000..U+FFFF range, due to JavaScript's UTF-16 strings (but this is not a difficult fix)
EDIT 2: Pictures!
EDIT 3: My script doesn't do this, but input strings SHOULD be placed in NFC (or NFKC?) normalization form before processing.
Resolved through content warnings
Most helpful comment
I threw together a ROT* cypher which will work for any script, and is identical to ROT13 for ASCII Latin, which you can test here: https://marrus-sh.github.io/rotstar/
Basically, I just collected which Unicode characters were letters from
LineBreaks.txt
in the Unicode Character Database and did alength/2
shift over each contiguous block. (For odd-lengthed blocks, the last letter in the block is left out.) Punctuation and other characters (importantly, characters regarding text direction and variation selectors) are left untouched鈥攐nly letter characters are affected.The cypher results won't necessarily make a whole lot of conceptual sense in many languages鈥攊t might be a mess of capitals and lower-case, for example, depending on how Unicode broke up the blocks鈥攂ut it is functional and tweaking could always happen in the future.
I don't have a strong opinion on whether ROT13 gets implemented into Mastodon or not, but this should at least keep the option open.
EDIT: Probably worth mentioning that the example above only works on characters in the U+0000..U+FFFF range, due to JavaScript's UTF-16 strings (but this is not a difficult fix)
EDIT 2: Pictures!

EDIT 3: My script doesn't do this, but input strings SHOULD be placed in NFC (or NFKC?) normalization form before processing.