npp-plugins / mimetools

Other
43 stars 11 forks source link

Encode and decode remove last characters #16

Closed rob-spoor closed 2 years ago

rob-spoor commented 2 years ago

I first encountered this issue with part of a JWT: eyJhbGciOiJub25lIn0. According to https://www.base64decode.org/, this decodes to {"alg":"none"}. However, the MIME Tools Base64 Decode removes the last character: {"alg":"none".

A little experimenting shows this is also the case for encoding. If I encode Hello world, the result is SGVsbG8gd29ybA. If I decode this with https://www.base64decode.org/, the result is Hello worl. MIME Tools gives the same result. Encoding Hello world with https://www.base64encode.org/ gives SGVsbG8gd29ybGQ=, which is is decoded correctly with MIME Tools.

If I use Hello world! as input, this encodes to SGVsbG8gd29ybGQ (the same as https://www.base64encode.org/ but without the trailing =; https://www.base64decode.org/ results in Hello world), which is then decoded to Hello worl. In other words, using just this plugin, I lose one character in encoding and one in decoding.

Notepad++ version: 8.4.1 (64bit) MIME Tools version: 2.7

donho commented 2 years ago

New version of MimeTools (v2.8) can be downloaded here: https://github.com/npp-plugins/mimetools/releases/tag/v2.8