SYNOPSIS

convmv [options] \s-1FILE\s0(S) ... \s-1DIRECTORY\s0(S)

OPTIONS

-f \s-1ENCODING\s0

specify the current encoding of the filename(s) from which should be converted

-t \s-1ENCODING\s0

specify the encoding to which the filename(s) should be converted

-i

interactive mode (ask y/n for each action)

-r

recursively go through directories

--nfc

target files will be normalization form C for \s-1UTF-8\s0 (Linux etc.)

--nfd

target files will be normalization form D for \s-1UTF-8\s0 (\s-1OS\s0 X etc.).

--qfrom , --qto

be more quiet about the \*(L"from\*(R" or \*(L"to\*(R" of a rename (if it screws up your terminal e.g.). This will in fact do nothing else than replace any non-ASCII character (bytewise) with ? and any control character with * on printout, this does not affect rename operation itself.

--exec command

execute the given command. You have to quote the command and #1 will be substituted by the old, #2 by the new filename. Using this option link targets will stay untouched. Example: convmv -f latin1 -t utf-8 -r --exec \*(L"echo #1 should be renamed to #2\*(R" path/to/files

--list

list all available encodings. To get support for more Chinese or Japanese encodings install the Perl HanExtra or \s-1JIS2K\s0 Encode packages.

--lowmem

keep memory footprint low by not creating a hash of all files. This disables checking if symlink targets are in subtree. Symlink target pointers will be converted regardlessly. If you convert multiple hundredthousands or millions of files the memory usage of convmv might grow quite high. This option would help you out in that case.

--nosmart

by default convmv will detect if a filename is already \s-1UTF8\s0 encoded and will skip this file if conversion from some charset to \s-1UTF8\s0 should be performed. \*(C`--nosmart\*(C' will also force conversion to \s-1UTF-8\s0 for such files, which might result in \*(L"double encoded \s-1UTF-8\s0\*(R" (see section below).

--notest

Needed to actually rename the files. By default convmv will just print what it wants to do.

--parsable This is not implemented yet.
--replace

if the file to which shall be renamed already exists, it will be overwritten if the other file content is equal.

--unescape

this option will remove this ugly % hex sequences from filenames and turn them into (hopefully) nicer 8-bit characters. After --unescape you might want to do a charset conversion. This sequences like %20 etc. are sometimes produced when downloading via http or ftp.

--upper , --lower

turn filenames into all upper or all lower case. When the file is not ASCII-encoded, convmv expects a charset to be entered via the -f switch.

--dotlessi

care about the dotless i/I issue. A lowercase version of \*(L"I\*(R" will also be dotless while an uppercase version of \*(L"i\*(R" will also be dotted. This is an issue for Turkish and Azeri. By the way: The superscript dot of the letter i was added in the Middle Ages to distinguish the letter (in manuscripts) from adjacent vertical strokes in such letters as u, m, and n. J is a variant form of i which emerged at this time and subsequently became a separate letter.

--help

print a short summary of available options

DESCRIPTION

convmv is meant to help convert a single filename, a directory tree and the contained files or a whole filesystem into a different encoding. It just converts the filenames, not the content of the files. A special feature of convmv is that it also takes care of symlinks, also converts the symlink target pointer in case the symlink target is being converted, too.

All this comes in very handy when one wants to switch over from old 8-bit locales to \s-1UTF-8\s0 locales. It is also possible to convert directories to \s-1UTF-8\s0 which are already partly \s-1UTF-8\s0 encoded. convmv is able to detect if certain files are \s-1UTF-8\s0 encoded and will skip them by default. To turn this smartness off use the \*(C`--nosmart\*(C' switch.

Filesystem issues

Almost all \s-1POSIX\s0 filesystems do not care about how filenames are encoded, here are some exceptions:

\s-1HFS+\s0 on \s-1OS\s0 X / Darwin

Linux and (most?) other Unix-like operating systems use the so called normalization form C (\s-1NFC\s0) for its \s-1UTF-8\s0 encoding by default but do not enforce this. Darwin, the base of the Macintosh \s-1OS\s0 enforces normalization form D (\s-1NFD\s0), where a few characters are encoded in a different way. On \s-1OS\s0 X it's not possible to create \s-1NFC\s0 \s-1UTF-8\s0 filenames because this is prevented at filesystem layer. On \s-1HFS+\s0 filenames are internally stored in \s-1UTF-16\s0 and when converted back to \s-1UTF-8\s0, for the underlying \s-1BSD\s0 system to be handable, \s-1NFD\s0 is created. See http://developer.apple.com/qa/qa2001/qa1173.html for defails. I think it was a very bad idea and breaks many things under \s-1OS\s0 X which expect a normal \s-1POSIX\s0 conforming system. Anywhere else convmv is able to convert files from \s-1NFC\s0 to \s-1NFD\s0 or vice versa which makes interoperability with such systems a lot easier.

\s-1JFS\s0

If people mount \s-1JFS\s0 partitions with iocharset=utf8, there is a similar problem, because \s-1JFS\s0 is designed to store filenames internally in \s-1UTF-16\s0, too; that is because Linux' \s-1JFS\s0 is really \s-1JFS2\s0, which was a rewrite of \s-1JFS\s0 for \s-1OS/2\s0. \s-1JFS\s0 partitions should always be mounted with iocharset=iso8859-1, which is also the default with recent 2.6.6 kernels. If this is not done, \s-1JFS\s0 does not behave like a \s-1POSIX\s0 filesystem and it might happen that certain files cannot be created at all, for example filenames in \s-1ISO-8859-1\s0 encoding. Only when interoperation with \s-1OS/2\s0 is needed iocharset should be set according to your used locale charmap.

\s-1NFS4\s0

Despite other \s-1POSIX\s0 filesystems \s-1RFC3530\s0 (\s-1NFS\s0 4) mandates \s-1UTF-8\s0 but also says: \*(L"The nfs4_cs_prep profile does not specify a normalization form. A later revision of this specification may specify a particular normalization form.\*(R" In other words, if you want to use \s-1NFS4\s0 you might find the conversion and normalization features of convmv quite useful.

\s-1FAT/VFAT\s0 and \s-1NTFS\s0

\s-1NTFS\s0 and \s-1VFAT\s0 (for long filenames) use \s-1UTF-16\s0 internally to store filenames. You should not need to convert filenames if you mount one of those filesystems. Use appropriate mount options instead!

How to undo double \s-1UTF-8\s0 (or other) encoded filenames

Sometimes it might happen that you \*(L"double-encoded\*(R" certain filenames, for example the file names already were \s-1UTF-8\s0 encoded and you accidently did another conversion from some charset to \s-1UTF-8\s0. You can simply undo that by converting that the other way round. The from-charset has to be \s-1UTF-8\s0 and the to-charset has to be the from-charset you previously accidently used. You should check to get the correct results by doing the conversion without \*(C`--notest\*(C' before, also the \*(C`--qfrom\*(C' option might be helpful, because the double utf-8 file names might screw up your terminal if they are being printed - they often contain control sequences which do funny things with your terminal window. If you are not sure about the charset which was accidently converted from, using \*(C`--qfrom\*(C' is a good way to fiddle out the required encoding without destroying the file names finally.

How to repair Samba files

When in the smb.conf (of Samba 2.x) there hasn't been set a correct \*(L"character set\*(R" variable, files which are created from Win* clients are being created in the client's codepage, e.g. cp850 for western european languages. As a result of that the files which contain non-ASCII characters are screwed up if you \*(L"ls\*(R" them on the Unix server. If you change the \*(L"character set\*(R" variable afterwards to iso8859-1, newly created files are okay, but the old files are still screwed up in the Windows encoding. In this case convmv can also be used to convert the old Samba-shared files from cp850 to iso8859-1.

By the way: Samba 3.x finally maps to \s-1UTF-8\s0 filenames by default, so also when you migrate from Samba 2 to Samba 3 you might have to convert your file names.

Netatalk interoperability issues

When Netatalk is being switched to \s-1UTF-8\s0 which is supported in version 2 then it is \s-1NOT\s0 sufficient to rename the file names. There needs to be done more. See http://netatalk.sourceforge.net/2.0/htmldocs/upgrade.html#volumes-and-filenames and the uniconv utility of Netatalk for details.

RELATED TO convmv…

locale\|(1) utf-8\|(7) charsets\|(7)

BUGS

no bugs or fleas known

AUTHOR

Bjoern \s-1JACKE\s0

Send mail to bjoern [at] j3e.de for bug reports and suggestions.