View previous topic :: View next topic |
Author |
Message |
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Sat Dec 18, 2004 6:00 pm Post subject: mount ntfs volume, chinese filenames |
|
|
如何mount 可以显示中文文件名? |
|
Back to top |
|
|
Hauser l33t
Joined: 27 Dec 2003 Posts: 650 Location: 4-dimensional hyperplane
|
Posted: Sat Dec 18, 2004 6:11 pm Post subject: |
|
|
Try this in your fstab:
Code: | /dev/hda5 /win ntfs users,iocharset=cp936,noauto 0 0
|
or cp950 if you use zh_TW.Big5 locale. _________________ AMD Athlon XP 2600+; 512M RAM;
nVidia FX5700LE; Hitachi 120Gb
2.6.9-nitro4, reiser4, linux26-headers+nptl
Do I like to compile everything?
Positive definite! |
|
Back to top |
|
|
akar Bodhisattva
Joined: 03 Dec 2004 Posts: 348 Location: HKSAR,China
|
Posted: Sat Dec 18, 2004 6:14 pm Post subject: |
|
|
這樣也可以, 如果你的 GNU/Linux環境是 UTF-8的編碼。
Code: | /dev/hda5 /mnt/win ntfs users,iocharset=utf8,noauto 0 0 |
_________________ AKar |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Sat Dec 18, 2004 6:50 pm Post subject: |
|
|
如何知道我用的是不是utf8?
另外不管我用iocharset=cp936 还是utf8, mount 出错
Code: |
mount: wrong fs type, bad option, bad superblock on /dev/hda6,
or too many mounted file systems
|
如果去掉iocharset=...这个option就没有问题
akar wrote: | 這樣也可以, 如果你的 GNU/Linux環境是 UTF-8的編碼。
Code: | /dev/hda5 /mnt/win ntfs users,iocharset=utf8,noauto 0 0 |
|
|
|
Back to top |
|
|
ts Tux's lil' helper
Joined: 15 Dec 2004 Posts: 97
|
Posted: Sat Dec 18, 2004 7:35 pm Post subject: |
|
|
wildleaf wrote: | 如何知道我用的是不是utf8?
另外不管我用iocharset=cp936 还是utf8, mount 出错
|
show your locale first
iocharset=gb2312
iocharset will depend on your locale |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Sat Dec 18, 2004 8:03 pm Post subject: |
|
|
which should i change to zh_CN? I still want to use english majorly but need to read chinese filenames.
I changed LANG=zh_CN.UTF-8, but mount still gave me the exact same error. Why?
Code: |
LANG=en_US.UTF-8
LC_CTYPE=zh_CN.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
|
ts wrote: | wildleaf wrote: | 如何知道我用的是不是utf8?
另外不管我用iocharset=cp936 还是utf8, mount 出错
|
show your locale first
iocharset=gb2312
iocharset will depend on your locale |
|
|
Back to top |
|
|
ts Tux's lil' helper
Joined: 15 Dec 2004 Posts: 97
|
Posted: Sat Dec 18, 2004 8:53 pm Post subject: |
|
|
wildleaf wrote: | which should i change to zh_CN? I still want to use english majorly but need to read chinese filenames.
I changed LANG=zh_CN.UTF-8, but mount still gave me the exact same error. Why?
|
I need more information, please run
Code: |
cat /etc/locales.build
|
In addition, I'm wondering what codepage (437 or 936) you select for your vfat system when you genkernel --menuconfig all. |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Sat Dec 18, 2004 10:26 pm Post subject: |
|
|
ts wrote: | wildleaf wrote: | which should i change to zh_CN? I still want to use english majorly but need to read chinese filenames.
I changed LANG=zh_CN.UTF-8, but mount still gave me the exact same error. Why?
|
I need more information, please run
Code: |
cat /etc/locales.build
|
In addition, I'm wondering what codepage (437 or 936) you select for your vfat system when you genkernel --menuconfig all. |
Here is the output of cat /etc/locales.build:
Code: |
wildleaf portage # cat /etc/locales.build
# This file names the list of locales to be built when glibc is installed.
# The format is <locale>/<charmap>, where <locale> is a locale from the
# /usr/share/i18n/locales directory, and <charmap> is name of one of the files
# in /usr/share/i18n/charmaps/. All blank lines and lines starting with # are
# ignored. Here is an example:
# en_US/ISO-8859-1
en_US/ISO-8859-1
en_US.UTF-8/UTF-8
ja_JP.EUC-JP/EUC-JP
ja_JP.UTF-8/UTF-8
ja_JP/EUC-JP
en_HK/ISO-8859-1
en_PH/ISO-8859-1
de_DE/ISO-8859-1
de_DE@euro/ISO-8859-15
es_MX/ISO-8859-1
fa_IR/UTF-8
fr_FR/ISO-8859-1
fr_FR@euro/ISO-8859-15
it_IT/ISO-8859-1
| [/code] |
|
Back to top |
|
|
ts Tux's lil' helper
Joined: 15 Dec 2004 Posts: 97
|
Posted: Sun Dec 19, 2004 2:59 am Post subject: |
|
|
wildleaf wrote: |
Here is the output of cat /etc/locales.build:
Code: |
wildleaf portage # cat /etc/locales.build
# This file names the list of locales to be built when glibc is installed.
# The format is <locale>/<charmap>, where <locale> is a locale from the
# /usr/share/i18n/locales directory, and <charmap> is name of one of the files
# in /usr/share/i18n/charmaps/. All blank lines and lines starting with # are
# ignored. Here is an example:
# en_US/ISO-8859-1
en_US/ISO-8859-1
en_US.UTF-8/UTF-8
ja_JP.EUC-JP/EUC-JP
ja_JP.UTF-8/UTF-8
ja_JP/EUC-JP
en_HK/ISO-8859-1
en_PH/ISO-8859-1
de_DE/ISO-8859-1
de_DE@euro/ISO-8859-15
es_MX/ISO-8859-1
fa_IR/UTF-8
fr_FR/ISO-8859-1
fr_FR@euro/ISO-8859-15
it_IT/ISO-8859-1
|
|
我想你应该把中文加入你的 locales.build,法语和日语等其它语言没有必要,你可以把文件改成如下这样:
Code: |
# This file names the list of locales to be built when glibc is installed.
# The format is <locale>/<charmap>, where <locale> is a locale from the
# /usr/share/i18n/locales directory, and <charmap> is name of one of the files
# in /usr/share/i18n/charmaps/. All blank lines and lines starting with # are
# ignored. Here is an example:
# en_US/ISO-8859-1
en_US/ISO-8859-1
en_US.UTF-8/UTF-8
zh_CN.UTF-8/UTF-8
zh_CN/gb2312
|
完了之后,试一下 mount 你的分区;不行,再试一下
Code: | export LC_ALL="zh_CN.UTF-8/UTF-8" |
再试一下用 iocharset=UTF8 来 mount 你的分区;如果还不行(这也是最可能发生的情况),你需要重新重新编译你的 kde,我就不知道你是否有时间和精力呢。
Good luck, 兄弟。 |
|
Back to top |
|
|
ts Tux's lil' helper
Joined: 15 Dec 2004 Posts: 97
|
Posted: Sun Dec 19, 2004 3:04 am Post subject: |
|
|
补充一下,
当你:
Code: | genkernel --menuconfig all |
DOS/VFAT 的编码选项时绝对不能选 cp936 或 gb2312,只能是默认值。要不任何 iocharset 选项都不会 work,我想这是核心的一个 bug。 |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Sun Dec 19, 2004 3:57 am Post subject: |
|
|
NO, I didn't select that. BTW, i want to mount a ntfs volume, not VFAT.
ts wrote: | 补充一下,
当你:
Code: | genkernel --menuconfig all |
DOS/VFAT 的编码选项时绝对不能选 cp936 或 gb2312,只能是默认值。要不任何 iocharset 选项都不会 work,我想这是核心的一个 bug。 |
|
|
Back to top |
|
|
Hauser l33t
Joined: 27 Dec 2003 Posts: 650 Location: 4-dimensional hyperplane
|
Posted: Sun Dec 19, 2004 4:41 am Post subject: |
|
|
ts wrote: | 我想你应该把中文加入你的 locales.build,法语和日语等其它语言没有必要,你可以把文件改成如下这样:
Code: |
# This file names the list of locales to be built when glibc is installed.
# The format is <locale>/<charmap>, where <locale> is a locale from the
# /usr/share/i18n/locales directory, and <charmap> is name of one of the files
# in /usr/share/i18n/charmaps/. All blank lines and lines starting with # are
# ignored. Here is an example:
# en_US/ISO-8859-1
en_US/ISO-8859-1
en_US.UTF-8/UTF-8
zh_CN.UTF-8/UTF-8
zh_CN/gb2312
|
完了之后,试一下 mount 你的分区;不行,再试一下
Code: | export LC_ALL="zh_CN.UTF-8/UTF-8" |
再试一下用 iocharset=UTF8 来 mount 你的分区;如果还不行(这也是最可能发生的情况),你需要重新重新编译你的 kde,我就不知道你是否有时间和精力呢。 |
如果之前設了locales.build而又沒有中文的locale,現在光是加進去是不行的,你得重編glibc才行。
另外編譯kernel的時候要把Native Language Support裡中文及UTF-8的選項編進去。 _________________ AMD Athlon XP 2600+; 512M RAM;
nVidia FX5700LE; Hitachi 120Gb
2.6.9-nitro4, reiser4, linux26-headers+nptl
Do I like to compile everything?
Positive definite! |
|
Back to top |
|
|
ts Tux's lil' helper
Joined: 15 Dec 2004 Posts: 97
|
Posted: Sun Dec 19, 2004 6:54 am Post subject: |
|
|
Hauser wrote: |
如果之前設了locales.build而又沒有中文的locale,現在光是加進去是不行的,你得重編glibc才行。
另外編譯kernel的時候要把Native Language Support裡中文及UTF-8的選項編進去。 |
Good points, you are right. |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Sun Dec 19, 2004 5:38 pm Post subject: |
|
|
Does it mean I have to recompile the entire system?
Hauser wrote: |
如果之前設了locales.build而又沒有中文的locale,現在光是加進去是不行的,你得重編glibc才行。
另外編譯kernel的時候要把Native Language Support裡中文及UTF-8的選項編進去。 |
|
|
Back to top |
|
|
Hauser l33t
Joined: 27 Dec 2003 Posts: 650 Location: 4-dimensional hyperplane
|
Posted: Sun Dec 19, 2004 5:42 pm Post subject: |
|
|
There's no need to do that. Just recompile glibc, and if necessary, the kernel. _________________ AMD Athlon XP 2600+; 512M RAM;
nVidia FX5700LE; Hitachi 120Gb
2.6.9-nitro4, reiser4, linux26-headers+nptl
Do I like to compile everything?
Positive definite! |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Sun Dec 19, 2004 5:58 pm Post subject: |
|
|
Thanks guys! I found I by mistake set CP936 and CP950 and UTF8 as Module in the Native Language Support and forgot to load them. After I insmod, now i can mount it using iocharset=cp926 or utf8 option. But the chinese file name does not show up correctly. What is the problem now?
Is this because I have to recompile glibc? And how can I recompile it? emerge glibc?
Also, is it better to compile language support into kernel instead of modules?
Sorry still one more, How do I know my system is now using UTF8 or not , since the language option was not loaded ever. |
|
Back to top |
|
|
ts Tux's lil' helper
Joined: 15 Dec 2004 Posts: 97
|
Posted: Mon Dec 20, 2004 1:54 am Post subject: |
|
|
wildleaf wrote: | But the chinese file name does not show up correctly. What is the problem now?
Is this because I have to recompile glibc? And how can I recompile it? emerge glibc? |
这样就好
Quote: | Also, is it better to compile language support into kernel instead of modules?
Sorry still one more, How do I know my system is now using UTF8 or not , since the language option was not loaded ever. |
刚才我又重新编译核心试了一下,只要你 make.conf 文件 USE 设了 nls,默认就是 utf8,编译时各语言包作为模块就行。
但是,我试了一下不同的 iocharset,只有 gb2312 才行,好像如果 cp936(gb2312) 和 UTF8 同时选择的话,gb2312 优先。
good luck. |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Mon Dec 20, 2004 5:44 am Post subject: not work:( |
|
|
I had no luck to make this work:(
I use this to mount
Code: |
wildleaf mnt # mount -t ntfs -o iocharset=cp936 /dev/hda6 d
|
then I got
Code: |
wildleaf Chinese # dir
\301\367\320\320\270\350\307\372
wildleaf Chinese # ll
ls: �����: No such file or directory
total 0
wildleaf Chinese #
|
|
|
Back to top |
|
|
akar Bodhisattva
Joined: 03 Dec 2004 Posts: 348 Location: HKSAR,China
|
Posted: Mon Dec 20, 2004 8:23 am Post subject: |
|
|
I think it is the locale problem of the user root
How about,
Code: |
# mount -t ntfs -o iocharset=cp936 /dev/hda6 d
# export LC_ALL=zh_CN.GB2312
#ls
|
it is only locale problem for the root user for your case.
explaination
.config of kernel 2.6.9
Code: |
glc linux # grep -i nls .config |grep -v ^#
CONFIG_UDF_NLS=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_936=m
CONFIG_NLS_CODEPAGE_950=m
CONFIG_NLS_ISO8859_1=m
CONFIG_NLS_UTF8=m
|
For my kernel 2.6.9, the nls modules are black magicly loaded when need
Mount without any parameter, module nls_iso8859_1(nls default in kernel config) is loaded
Code: |
glc root # mount /dev/hda6 /mnt/C
glc root # lsmod
Module Size Used by
nls_iso8859_1 4096 1
nvidia 4814004 12
eepro100 25868 0
|
Mount with parameter "iocharset=utf8", we can see:
1. the module "nls_iso8859_1" is still there but Used=0 after umount the previous mount!!
2. the module "nls_utf8" is now loaded
Code: |
glc root # umount /mnt/C
glc root # mount -o iocharset=utf8 /dev/hda6 /mnt/C
glc root # lsmod
Module Size Used by
nls_utf8 1920 1
nls_iso8859_1 4096 0
|
I have not read the kernel manual, but i think the Used=N of every kernel module is to support the experiment "unload module" feature of kernel. N<>0, is a module that should not be unloaded.
edit.20041221: better BBcode formating _________________ AKar
Last edited by akar on Tue Dec 21, 2004 7:55 am; edited 1 time in total |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Tue Dec 21, 2004 6:19 am Post subject: :( |
|
|
Thanks! But It is not working:(
Here is what i got:
Code: |
wildleaf Chinese # grep -i nls /usr/src/linux/.config |grep -v ^#
CONFIG_UDF_NLS=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_CODEPAGE_936=m
CONFIG_NLS_CODEPAGE_950=m
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_UTF8=m
|
and when I mount it using cp936
Code: |
Module Size Used by
nls_utf8 2688 0
nls_cp950 104832 0
nls_cp936 127232 1
ntfs 143632 1
e100 31360 0
|
Any other ideas? |
|
Back to top |
|
|
akar Bodhisattva
Joined: 03 Dec 2004 Posts: 348 Location: HKSAR,China
|
Posted: Tue Dec 21, 2004 8:38 am Post subject: Re: not work:( |
|
|
wildleaf wrote: | I had no luck to make this work:(
I use this to mount
Code: |
wildleaf mnt # mount -t ntfs -o iocharset=cp936 /dev/hda6 d
|
|
I have overlook, your preferred codepage is zh_CN.UTF-8, so
Code: |
wildleaf mnt # mount -t ntfs -o iocharset=utf8 /dev/hda6 d
wildleaf mnt # ls d
|
to see if it works.
---If the above still not work !! ---
Hmmm,,,,, i should invite you to create a file with Chinese name to test if your system is Chinese ready.
at least set LC_CTYPE to processing chinese characters.
Code: |
$ export LC_CTYPE="zh_CN.UTF-8"
|
TestCase: if the file with chinese name created under Linux native file sytem is handled correctly.
Code: |
$ touch /tmp/中文文件名.txt
$ ls /tmp/
|
_________________ AKar |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Tue Dec 21, 2004 3:47 pm Post subject: Re: not work:( |
|
|
akar wrote: |
I have overlook, your preferred codepage is zh_CN.UTF-8, so
Code: |
wildleaf mnt # mount -t ntfs -o iocharset=utf8 /dev/hda6 d
wildleaf mnt # ls d
|
to see if it works.
|
I tried this utf8 before, didn't work either.
Quote: |
---If the above still not work !! ---
Hmmm,,,,, i should invite you to create a file with Chinese name to test if your system is Chinese ready.
at least set LC_CTYPE to processing chinese characters.
Code: |
$ export LC_CTYPE="zh_CN.UTF-8"
|
TestCase: if the file with chinese name created under Linux native file sytem is handled correctly.
Code: |
$ touch /tmp/中文文件名.txt
$ ls /tmp/
|
|
I've no problem to create and see chinese name while i'm in gnome, but i cant see chinese names without it. Also, the mount is still not working.
If I give you a test account, could u log on and see what 's wrong?
wildleaf.3322.org
user: testuser
pass: wildleaf
Thanks! |
|
Back to top |
|
|
akar Bodhisattva
Joined: 03 Dec 2004 Posts: 348 Location: HKSAR,China
|
Posted: Wed Dec 22, 2004 3:10 am Post subject: |
|
|
: btw, i have changed the passwd of the account "testuser".
i found you have recompiled the kernel! now the nls modules are compiled into kernel. Make sure you are using the correct kernel to boot up your Gentoo, (and of coz the new compiled version has properly installed). otherwise mounting with option of "iocharset=utf8" will prompt you an error.
During my login session, i found your have mounted two ntfs, but WITHOUT the iocharset=utf8 option. was it having problem when mounting with such option?
Code: |
$ mount
/dev/hda6 on /mnt/d type ntfs (rw,noexec,nosuid,nodev,umask=0022)
/dev/hda7 on /mnt/e type ntfs (rw,noexec,nosuid,nodev,umask=0022) |
mine is something like:
Code: |
/dev/hda6 on /mnt/D type vfat (rw,noexec,nosuid,nodev,umask=022,iocharset=utf8,iocharset=utf8)
|
_________________ AKar |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Wed Dec 22, 2004 3:26 am Post subject: |
|
|
Thanks a lot! It works now! But I didn't figure out why it works
Here is what I did today:
1. I do recompiled kernel with language support (utf8, cp936, cp950) built in
2. recompiled glibc with updated locales.build
3. unmerge linux-headers, merge linux26-headers
4. recompiled glibc
5. merge kde
Then I suspect it is only because I built the language support into kernel instead of modules. This is weird.
But anyway, thanks guys, everything is working now, kde works much better than gnome, i like it.
akar wrote: | : btw, i have changed the passwd of the account "testuser".
i found you have recompiled the kernel! now the nls modules are compiled into kernel. Make sure you are using the correct kernel to boot up your Gentoo, (and of coz the new compiled version has properly installed). otherwise mounting with option of "iocharset=utf8" will prompt you an error.
During my login session, i found your have mounted two ntfs, but WITHOUT the iocharset=utf8 option. was it having problem when mounting with such option?
Code: |
$ mount
/dev/hda6 on /mnt/d type ntfs (rw,noexec,nosuid,nodev,umask=0022)
/dev/hda7 on /mnt/e type ntfs (rw,noexec,nosuid,nodev,umask=0022) |
mine is something like:
Code: |
/dev/hda6 on /mnt/D type vfat (rw,noexec,nosuid,nodev,umask=022,iocharset=utf8,iocharset=utf8)
|
|
Last edited by wildleaf on Wed Dec 22, 2004 3:32 am; edited 1 time in total |
|
Back to top |
|
|
wildleaf n00b
Joined: 12 Oct 2004 Posts: 71
|
Posted: Wed Dec 22, 2004 3:31 am Post subject: OK |
|
|
OK a last question.
akar I cant be happier if you can help me fix this
Now I can read the chinese file names of the mounted volumes correctly only in kde/gnome. The chinese characters are screwed in text mode, say, when i'm not running X. How can I get this fixed? |
|
Back to top |
|
|
|