npp-plugins / mimetools

Other
43 stars 11 forks source link

MIME Quoted-printable Decode fails to decode pattern just encoded by the Encode plugin #11

Closed ggodhner closed 6 months ago

ggodhner commented 5 years ago

Description of the Issue The MIME Quoted-printable Decode fails to decode a pattern that was just encoded by the Encode

Steps to Reproduce the Issue

I have taken the following three URLs as an example, and encoded them: https://www.automationdirect.com/adc/shopping/catalog/enclosures_-z-_subpanels_-z-_thermal_management_-z-_lighting/enclosures/junction_boxes/jic040403

https://www.automationdirect.com/adc/shopping/catalog/enclosures_-z-_subpanels_-z-_thermal_management_-z-_lighting/enclosures/junction_boxes/jic0403025

https://www.automationdirect.com/adc/shopping/catalog/enclosures_-z-_subpanels_-z-_thermal_management_-z-_lighting/enclosures/junction_boxes/jic040202

When I encode them I get the following result: https://www.automationdirect.com/adc/shopping/catalog/enclosures_-z-_subpa= nels_-z-thermal_management-z-_lighting/enclosures/junction_boxes/jic04040= 3

https://www.automationdirect.com/adc/shopping/catalog/enclosures_-z-_subpa= nels_-z-thermal_management-z-_lighting/enclosures/junction_boxes/jic04030= 25

https://www.automationdirect.com/adc/shopping/catalog/enclosures_-z-_subpa= nels_-z-thermal_management-z-_lighting/enclosures/junction_boxes/jic04020= 2

Expected Behavior When I select this text again and run the MIME Quoted-printable Decode routine I expect to get the original URLs replacing the encoded text.

Actual Behavior Instead I get a popup message with the title "Quoted-printable decode error" and the text "It's not a valid Quoted-printable text" and an "OK" button to dismiss the popup message.

Debug Information Notepad++ v7.7 (32-bit) Build time : May 19 2019 - 13:08:20 Path : C:\Program Files (x86)\Notepad++\notepad++.exe Admin mode : OFF Local Conf mode : OFF OS : Windows 7 (64-bit) Plugins : ComparePlugin.dll DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll

Additional comments: The file is UTF-8 encoded with Unix line endings. I would expect the plugin to recognize the line endings in the file and adapt to them. It appears to handle them well on encoding, but on decoding it chokes. It does not encode them differently so as to recognize them when decoding them, which it should if it needs to in order to recognize the difference. MIME encoding is meant to work with Unix encoded files just as well as Windows encoded files, though I don't know what the MIME specification says about how to handle the different line endings.

donho commented 6 months ago

https://github.com/npp-plugins/mimetools/issues/15#issuecomment-1865444777

donho commented 6 months ago

The non-eligible format is finally accepted for decoding. However, the encoded format remains the eligible one. A PR for addressing this issue will be provided soon.