clalancette / pycdlib

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

An error occurred When inputted Chinese characters for vol_ident #75

Open abcmouse opened 2 years ago

abcmouse commented 2 years ago

An error occurred When inputted Chinese characters for vol_ident. Message as follows:

File "\site-packages\pycdlib\utils.py", line 135, in encode_space_pad output = instr.decode('utf-8').encode(encoding) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

clalancette commented 2 years ago

So it's an interesting case. Ecma-119 (which is the same as ISO9660) says that the Volume Identifier field must be "d-characters". In Ecma-119 jargon, d-characters are the ASCII characters 0-9, A-Z (upper case only), and underscore. So the original standard doesn't actually allow for this, and that is what pycdlib currently implements.

That said, it is likely that some utilities violate the standard and allow this. It is also possible that UDF allows this (although vol_ident isn't properly plumbed through to the UDF stuff anyway).

Out of curiousity, do you have examples of software that allows Chinese characters to be specified for vol_ident, and examples of software that will read and display it back properly?

abcmouse commented 2 years ago

Thanks for you reply. I know UltraISO can do this. 2021-11-18_152326

clalancette commented 2 years ago

Hm, that's interesting. I just downloaded Ultra ISO (the English version), and I'm trying to create an ISO with Chinese characters, but it won't let me do it. I always get mojibake. In the screenshot above, are you creating an ISO or opening an existing one? If you are opening an existing one, can you point me to the software that created the ISO initially? If you are creating an ISO, what version of Ultra ISO are you using (and which language version did you download)?

abcmouse commented 2 years ago

Yes, I created an ISO file with UltraISO, saved it and opened it again. UltraISO can well support Chinese characters, which maybe the reason is I use the Chinese operating system. The multilanguage UltraISO version is ver 9.7.6.3829.

basharbachir commented 2 years ago

didnt solve yet ?

clalancette commented 2 years ago

didnt solve yet ?

Sorry, I should have updated this. I tried to use UltraISO a few different times, but I was never able to convince it to accept anything but ASCII characters in the VOL_IDENT field. If someone can provide me with a sample ISO that has the problem, I can take a look.

changlichun commented 2 months ago

It seems Chinese characters still not work. image 20240709_094731.zip