Wednesday, December 19, 2007

iocharset, deprecated option but might be of use

Thanks to various encoding systems which makes the world diverse.

First of all, this is extracted from manual from mount on Debian Linux
Mount options for ntfs
Character set to use when returning file names. Unlike VFAT,
NTFS suppresses names that contain unconvertible characters.

New name for the option earlier called iocharset.

utf8 Use UTF-8 for converting file names.

Typically, you don't need the iocharset option when you are using an UTF-8 locale. But when it comes that you have to transfer some ugly-named files to other systems that don't have an UTF-8 support (or when you can't turn it on, like on Windows), the iocharset option turns out useful. What I was doing recently is to transfer files from an old PC to a new laptop. The files are in an NTFS partition, but for some reason, the driver is used as a secondary HDD on a running Debian Linux, which means I can not unplug it or reboot to windows. The new laptop is running windows. To solve this problem is easy. Mount the NTFS partition and transfer files using scp. (Installation of scp clients on the laptop is necessary though). As my windows is using codepage 936 or GBK as default, mount the partition as follows
mount -t ntfs -o iocharset=cp936,umask=022 /dev/hdd1 /mnt/ntfspart
and that is all. And the command (pscp is a scp client from putty)
pscp -ls someone@someaddr:/some/dir
returned well formed results, which will makes me happy.

Note that you might mess up the file names on your NTFS partition when writing data using an incorrect codepage. Please make sure you know what you are doing before striking the enter/return key.

No comments:

Post a Comment

Please post your comment here. ;)