-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate the last char in Plain text #32
Comments
Seems that function decodeQuotedPrintableHelper return function convertBytesToUnicodeCodePoints it will duplicate the previous bytes while where there is a var ret = decodeQuotedPrintableHelper("BLACKLISTED WAKE UP SMS SENT (+33612345678) : Votre code de v=C3=A9rifica=tion Koolicar : 140035=", "=")
ret /*=> [66, 76, 65, 67, 75, 76, 73, 83, 84, 69, 68, 32, 87, 65, 75, 69, 32, 85, 80, 32, 83, 77, 83, 32, 83, 69, 78, 84, 32, 40, 43, 51, 51, 54, 49, 50, 51, 52, 53, 54, 55, 56, 41, 32, 58, 32, 86, 111, 116, 114, 101, 32, 99, 111, 100, 101, 32, 100, 101, 32, 118, 195, 169, 114, 105, 102, 105, 99, 97, NaN, 111, 110, 32, 75, 111, 111, 108, 105, 99, 97, 114, 32, 58, 32, 49, 52, 48, 48, 51, 53, NaN] */
convertBytesToUnicodeCodePoints(ret, "UTF8") /*=> [66, 76, 65, 67, 75, 76, 73, 83, 84, 69, 68, 32, 87, 65, 75, 69, 32, 85, 80, 32, 83, 77, 83, 32, 83, 69, 78, 84, 32, 40, 43, 51, 51, 54, 49, 50, 51, 52, 53, 54, 55, 56, 41, 32, 58, 32, 86, 111, 116, 114, 101, 32, 99, 111, 100, 101, 32, 100, 101, 32, 118, 233, 114, 105, 102, 105, 99, 97, 97, 111, 110, 32, 75, 111, 111, 108, 105, 99, 97, 114, 32, 58, 32, 49, 52, 48, 48, 51, 53, 53] */ I think for this last char in if (str.charAt(i) == prefix ) {
ret= decoded_bytes.push(parseInt(str.substr(i + 1, 2), 16));
i += 3;
} but here : parseInt(str.substr(i + 1, 2), 16)
/* i + 1 == str.length so str.substr will return an empty string and parseInt will return NaN */ This can fix the NaN case : function decodeQuotedPrintableHelper(str, prefix) {
var decoded_bytes = [];
for (var i = 0; i < str.length;) {
if (str.charAt(i) == prefix) {
// here we check if it's not the end of the str
if (i + 1 < str.length) {
decoded_bytes.push(parseInt(str.substr(i + 1, 2), 16));
}
i += 3;
} else {
decoded_bytes.push(str.charCodeAt(i));
++i;
}
}
return decoded_bytes;
} hope this can help 😃 |
it should be fixed by this Pull Request: #33 |
I have the same issue, using encoding cp1252. |
I have a duplicate char in the plain text.
On Plain text i Have
But in source I have
Maybe the problem is in https://github.com/mailhog/MailHog-UI/blob/master/assets/js/strutil.js#L280
The text was updated successfully, but these errors were encountered: