LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1330|回复: 6

-o iocharset=utf8 和 -o utf8 的差异

[复制链接]
发表于 2007-4-16 15:16:12 | 显示全部楼层 |阅读模式
some experiments:

rick-debian:~# mount
/dev/hda9 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/hda10 on /boot type ext3 (rw)
/dev/hda5 on /media/D type vfat (rw,utf8)
/dev/hda6 on /media/E type vfat (rw,utf8)
/dev/hda8 on /media/F type vfat (rw,utf8)
/dev/hda1 on /media/C type vfat (rw,iocharset=utf8)

rick-debian:~# cat /media/C/abc
abcdfdf
rick-debian:~# cat /media/C/ABC
cat: /media/C/ABC: No such file or directory

when  save /media/C/ABC after editing, I got :
"/media/C/ABC"
"/media/C/ABC" E212: Can't open file for writing
Press ENTER or type command to continue


rick-debian:~# cat /media/D/abc
abcd
rick-debian:~# cat /media/D/ABC
abcd

when editing /media/D/ABC, just like editing /media/D/abc


所以, -o iocharset=utf8 不能很好的处理fat系统大小写不敏感的问题, -o utf8 就能正常处理.


我想知道的是, 为什么会有这样的差别
发表于 2007-4-16 15:39:07 | 显示全部楼层
回复 支持 反对

使用道具 举报

发表于 2007-4-17 09:17:40 | 显示全部楼层
你当前的locale是什么?一般而言,我们都会把iocharset设成和当前的locale一致。
要不你把当前的locale设置为en_US.utf8或者zh_CN.utf8,然后再用iocharset=utf8装载以下fat文件系统试试呢。
我听说过有些locale好像对大小写的支持有问题的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-4-17 10:20:56 | 显示全部楼层
locale 是 en_US.UTF-8
回复 支持 反对

使用道具 举报

发表于 2007-4-17 12:50:43 | 显示全部楼层
明白了一些
1. utf8 override iocharset或者nls的设置
2. 内核的nls如果没有编译utf8的话,可以使用-o utf8,同样能达到nls=utf8的效果
3. 对于vfat,推荐使用-o utf8而不是iocharset=utf8。原因不明

至于大小写,应该不用关心,我们可以按照linux的使用习惯即可。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-4-17 14:08:20 | 显示全部楼层
http://www.nslu2-linux.org/wiki/HowTo/MountFATFileSystems

  1. When the utf8 flag is specified along with iocharset the iocharset value only
  2. controls the character case handling - it has no effect on the encoding of the
  3. UNICODE characters as this will always use UTF-8.
复制代码


http://lkml.org/lkml/2006/7/13/259


  1. iocharset=utf8 doesn't have a case conversion table.

  2. utf8 option is similar to iocharset=utf8, but utf8 uses caseconversion table of
  3. iocharset=xxx. But, there is a known bug.
复制代码
回复 支持 反对

使用道具 举报

发表于 2007-4-17 14:35:25 | 显示全部楼层
NOTE: “iocharset=utf8″ is not recommended. If unsure,
you should consider the following option instead.
内核documentaiton/filesystems/vfat.txt
也推荐使用-o utf8 选项。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表