genisoimage/mkisofs "Incorrectly encoded string" error

Posted in Linux/Unix/BSD -

While creating some ISO images for backup purposes earlier this week, I got the error message "Incorrectly encoded string" and "Possibly creating an invalid Joliet extension" when using genisoimage/mkisofs to create the image.

The command I used was as follows:

mkisofs -J -r -hide-rr-moved -joliet-long -o cd.iso .

The start of the output looked like this:

I: -input-charset not specified, using utf-8 (detected in locale settings)
Using SERVI000.PHP;1 for...

and the command then showed me a full list of the filename used and the actual full filename and finished with this:

Incorrectly encoded string (SER?E_LIMANI.pdf) encountered.
Possibly creating an invalid Joliet extension. Aborting.

I assumed that because of the "-input-charset not specified" message at the start that this was going to be due to an characterset encoding issue, because the PDF file causing the issue used some odd character that wasn't supported by the default character set used.

A quick look at the manpage for genisoimage/mkisofs revealed this: (man genisoimage)

-input-charset charset
  Input charset that defines the characters used in local filenames. 
  To get a list of valid charset names, call genisoimage -input-charset help.
  To get a 1:1 mapping, you may use default as charset name. 
  The default initial values are cp437 on DOS-based systems and iso8859-1 on all other systems.
  See the CHARACTER SETS  section below for more details.

I decided to try using iso8859-1 as the input character set and issued the command again like so:

mkisofs -input-charset iso8859-1 -J -r -hide-rr-moved -joliet-long -o cd.iso .

This then worked perfectly and there were no errors. If you continue to get errors after trying the iso8859-1 character set then you can try another one. The available character sets can be displayed by issuing the following command:

genisoimage -input-charset help

This will display the available character sets, e.g.:

Unknown charset
Known charsets are:
cp10081
cp10079
cp10029
cp10007
cp10006
cp10000
koi8-u
koi8-r
cp1251
cp1250
cp874
cp869
cp866
cp865
cp864
cp863
cp862
cp861
cp860
cp857
cp855
cp852
cp850
cp775
cp737
cp437
iso8859-15
iso8859-14
iso8859-9
iso8859-8
iso8859-7
iso8859-6
iso8859-5
iso8859-4
iso8859-3
iso8859-2
iso8859-1

Additional input charsets are available for Joliet through the iconv support.
Run "iconv -l" to display them. Iconv charsets cannot be used with HFS, Apple
extension, ISO9660 version 2 or Rock Ridge.

About genisoimage/mkisofs

mkisofs and genisoimage are command line tools for creating ISO images which can then be burnt to CD or DVD; genisoimage is a fork of mkisofs and is part of the cdrkit suite. Most Linux distributions will symbolically link the command "mkisofs" to the "genisoimage" command to make it easy for people who are unfamiliar with the new command and for backward compatbility purposes.




Comments