You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use mail 2.5.4 with redmine and I found out that Encodings.value_decode() in encodings.rb sometimes returns incorrect values for subject when it is encoded in UTF-8. It happens when the subject contains 2 strings like this
=?UTF-8?B?0J/RgNC+0YjRgyDRgNCw0LfQvtCx0YDQsNGC0YzRgdGPINC4IA==?=
=?UTF-8?B?0L/RgNC40L3Rj9GC0Ywg0YHRgNC+0YfQvdGL0LUg0LzQtdGA0YssINCyIA==?=
When value_decode calls collapse_adjacent_encodings it will turn the strings into
one
=?UTF-8?B?0J/RgNC+0YjRgyDRgNCw0LfQvtCx0YDQsNGC0YzRgdGPINC4IA==
0L/RgNC40L3Rj9GC0Ywg0YHRgNC+0YfQvdGL0LUg0LzQtdGA0YssINCyIA==?=
However str.unpack('m') will only decode the first of initial strings. I mean that
will return the same result. I believe it's because the decode from base64 function will always stop when it gets '=' or '==' symbols in base64 string. So, I think, collapsing adjacent encodings is not a proper thing to do at all. Cause you still have to decode every string separately.
The text was updated successfully, but these errors were encountered:
I use mail 2.5.4 with redmine and I found out that Encodings.value_decode() in encodings.rb sometimes returns incorrect values for subject when it is encoded in UTF-8. It happens when the subject contains 2 strings like this
=?UTF-8?B?0J/RgNC+0YjRgyDRgNCw0LfQvtCx0YDQsNGC0YzRgdGPINC4IA==?=
=?UTF-8?B?0L/RgNC40L3Rj9GC0Ywg0YHRgNC+0YfQvdGL0LUg0LzQtdGA0YssINCyIA==?=
When value_decode calls collapse_adjacent_encodings it will turn the strings into
one
=?UTF-8?B?0J/RgNC+0YjRgyDRgNCw0LfQvtCx0YDQsNGC0YzRgdGPINC4IA==
0L/RgNC40L3Rj9GC0Ywg0YHRgNC+0YfQvdGL0LUg0LzQtdGA0YssINCyIA==?=
However str.unpack('m') will only decode the first of initial strings. I mean that
and
will return the same result. I believe it's because the decode from base64 function will always stop when it gets '=' or '==' symbols in base64 string. So, I think, collapsing adjacent encodings is not a proper thing to do at all. Cause you still have to decode every string separately.
The text was updated successfully, but these errors were encountered: