keybase-issues icon indicating copy to clipboard operation
keybase-issues copied to clipboard

Telegram messes with dash line formatting

Open 0utrider opened this issue 10 years ago • 2 comments

Hello, I know this is not technically an error on Keybase's side all, but it may prove to be a frustration to the less tech-savvy users out there.

An example signed message I was showing my friends in a Telegram chat:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Captain Crunch is delicious.

I'm David and I approve of this message!
-----BEGIN PGP SIGNATURE-----
Version: Keybase OpenPGP v2.0.56
Comment: https://keybase.io/crypto

wsBcBAABCgAGBQJX3X80AAoJECgJko4B16hwoMoH/iiY2At85LKH6lFJV9nh/a+/
+It+t12srZYStVOxP33FAf0WDNPZ9vwSoJscMlVO00Q3YkUCx5L01UTp/ozBanRW
0yBbWcCYGP96H2Jc2t4imDGJ1cvD/2MsjShfHSawXIUXLo58QdPHcQhzG9KSLU4B
A5LKCfEzW+n4lJYzfyLvIJTTU9VU+WE7bZGMl0Wld9VT6C0+CRR7sVEfqDZmIBGy
QXNYf0KhugaZWFgQvsVSXEQwM0KiE96AfovincgCjzPeFtAur1BS7aBK/4dcULfq
VybA3c7/qQJdJKwSKbMyn99/H6W32J9e7kvkyugxdPxold4ZP7dj58FCHUCFhXw=
=iE6p
-----END PGP SIGNATURE-----

What Telegram actually displays (and copies/pastes back):

-----BEGIN PGP SIGNED MESSAGE---—
Hash: SHA512

Captain Crunch is delicious.

I'm David and I approve of this message!
—---BEGIN PGP SIGNATURE---—
Version: Keybase OpenPGP v2.0.56
Comment: https://keybase.io/crypto

wsBcBAABCgAGBQJX3X80AAoJECgJko4B16hwoMoH/iiY2At85LKH6lFJV9nh/a+/
+It+t12srZYStVOxP33FAf0WDNPZ9vwSoJscMlVO00Q3YkUCx5L01UTp/ozBanRW
0yBbWcCYGP96H2Jc2t4imDGJ1cvD/2MsjShfHSawXIUXLo58QdPHcQhzG9KSLU4B
A5LKCfEzW+n4lJYzfyLvIJTTU9VU+WE7bZGMl0Wld9VT6C0+CRR7sVEfqDZmIBGy
QXNYf0KhugaZWFgQvsVSXEQwM0KiE96AfovincgCjzPeFtAur1BS7aBK/4dcULfq
VybA3c7/qQJdJKwSKbMyn99/H6W32J9e7kvkyugxdPxold4ZP7dj58FCHUCFhXw=
=iE6p
—---END PGP SIGNATURE---—

If you pay close attention to the dashes, you'll see that Telegram has replaced the standard dash (or "minus") with the long em-dash character ( — ). What's more, it seems to replace two -'s with single —'s

Plugging this into the web too, or command line tool, lets you know there's no headers. The "easy" fix is to make sure there are five regular dashes on each header line; but that only works if you know what to look. I see this becoming a problem with other chat clients and e-mail clients like Outlook, which loves to do funky things with em-dashes.

For the sake of the less technical users out there, we may want to look at an option that tries to fix that for the sake of the user's sanity? Perhaps code that will check for the header errors, then attempt to regex dashes and emdashes around the common PGP headers (like "BEGIN PGP SIGNATURE"), replace it with the standard five dashes.

0utrider avatar Sep 17 '16 17:09 0utrider

This can easily be fixed by using a bit of markdown.

Simply adding markdown code blocks (3 backticks before and 3 after) will ensure that your code block is sent exactly how it is pasted. I highly doubt Telegram would accept this change simply to appease a small number of users in a very niche situation need it. For now you'll have to be married to backticks to be perfectly honest.

zQueal avatar Sep 17 '16 18:09 zQueal

I agree - but I'm saying not everyone, including senders and recipients, will know what's going on and why it's not working. It's the user experience that I'm pointing this out for.

Ideally, I'd have the (Keybase) software fix it for you, but maybe display a little header/window saying that formatting errors were fixed, links to recommendations formatting info and fixes like backticks in Telegram, etc.

0utrider avatar Sep 17 '16 18:09 0utrider