clalancette / pycdlib

Python library to read and write ISOs
GNU Lesser General Public License v2.1
143 stars 38 forks source link

Error decoding filenames for non ascii characters. #88

Closed MugurAnghel closed 1 year ago

MugurAnghel commented 2 years ago

There are issues with ISO files created by PowerISO that contain files that use non ascii characters. For example I stumbled upon a sample with Vietnamese letters. This causes pycdlib to crash with UnicodeDecodeError: 'utf8' codec can't decode byte 0xea in position 1: invalid continuation byte

The encoding used appears to be latin-1 in this scenario, however the parser does not seem to pick this up. I believe relaxing the decoding scheme ( errors='ignore' ) could potentially solve (at least partially) the issue. I did not have the chance to test or analyse this in depth (especially for Rock Ridge/Joliet).

I cant attach ISO files in this form but it's quite simple to reproduce:

  1. PowerISo 32 bit -> new image
  2. Add a file (or folders) that contain non standard characters (my sample has "Yêu cầu ưu đãi" in the file name).
  3. Open the file with pycdlib and try to call the walk method. Will result in the error mentioned above.
clalancette commented 2 years ago

Yeah, this is similar to #75 . In short, the library currently only uses ASCII encoding, as that is what is called out in the specification. We can probably lift the restriction pretty easily, but I still haven't been able to create an ISO that has these characters. Every time I try with PowerIso, it won't let me use non-ASCII characters. I'll try again at some point.

clalancette commented 1 year ago

So I finally got a chance to look at this, and I think with the changes that I made for #75, this is now fixed. That said, I ended up adding in a specific test for Vietnamese in 312f19a1748217854cacab7dd89decc20428f9ba .

With all of that said, I'm going to close this out. Feel free to reopen if you think this is still a problem.