Merge lp:~cmiller/apport/attach_drm into lp:~apport-hackers/apport/trunk
Proposed by
Chad Miller
Status: | Merged |
---|---|
Merged at revision: | 2918 |
Proposed branch: | lp:~cmiller/apport/attach_drm |
Merge into: | lp:~apport-hackers/apport/trunk |
Diff against target: |
19 lines (+3/-3) 1 file modified
apport/hookutils.py (+3/-3) |
To merge this branch: | bzr merge lp:~cmiller/apport/attach_drm |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Pitt (community) | Approve | ||
Review via email: mp+250831@code.launchpad.net |
Commit message
Open DRM files as if they're bytes, not an encoded Unicode string. Process bytes, and decode (as "latin1") as last step, to get Unicode. Avoid at least two TypeErrors in Py3.
To post a comment you must log in.
Thanks for this! But why do you decode them as latin-1? It was just encoded to base64, so ASCII should be fine. But "modes" and the others also just look like ASCII. So UTF-8 might still be a better default, or do you have a case where these attributes contain non-ASCII data which isn't UTF-8 either?
When presenting the data to the user, or downloading it from LP, apport will try and convert byte arrays to UTF-8 unicode strings; if that fails, the values are simply left as byte arrays. So either leave the entire info as a byte array, or try to convert it from ASCII or UTF-8 and if that fails with an UnicodeDecodeError, just leave it like it is?