koodaamo / tnefparse

a TNEF decoding library written in python, without external dependencies
GNU Lesser General Public License v3.0
49 stars 37 forks source link

tnef_attachement.name is not unicode #7

Closed guettli closed 5 years ago

guettli commented 9 years ago

I get a UnicodeError in my application code, because tnef_attachement.name is not unicode.

Could the tnef library get updated, to make tnef_attachement.name a unicode string?

In my case it looks like a latin1 string. It would improve the usability of the library if the application programmer does not need to do string decoding.

Sorry, I can't post the tnef binary, since it is from a customer.

BTW, how can you create tnef test binaries?

plq commented 7 years ago

fixed in fbcecac898dea06c9392f5020f232ca5dc310c47 if you call long_filename() AND there is a long filename to return

guettli commented 7 years ago

Unfortunately I don't have the matching test here to proof if the patch solves this issue.

I trust you and I think this issue can be closed.

Should I close it?

plq commented 7 years ago

I'm not in position to make that decision.

petri commented 6 years ago

Please, if you can, provide a PR.

petri commented 6 years ago

Note: master now strips null bytes from long_filename as well.

petri commented 6 years ago

The encoding of tnef attachment (long) names is a bit tricky to get right, it's not exactly simple.

See for example the discussion at https://github.com/roundcube/roundcubemail/issues/5646 .

If you have good understanding of how the encodings in tnef attachments work or any links to information, that would help.

petri commented 6 years ago

Note: we should also consider how this is to work on Python2 vs. Python3 (with help of six?)

jrideout commented 5 years ago

This should be addressed by #31

guettli commented 5 years ago

thank you!