Skip to contentSkip to conversation

FAT: doesn't recognize "iocharset=utf8" and doesn't use NLS_DEFAULT

PATCH In review OGAWA Hirofumi 2 participants 4 messages Jun 20, 2004

Subsystems (2)
lore
Share & tools
lore

OGAWA Hirofumi

author maintainer
#0 lore raw

PATCH 1/1 FAT: doesn't recognize "iocharset=utf8" and doesn't use NLS_DEFAULT

Hi,

Recently, the distributor has set "utf8" to NLS_DEFAULT, therefore, FAT uses the "iocharset=utf8" as default. But, since "iocharset=utf8" doesn't provide the function (lower <-> upper conversion) which FAT needs, so FAT can't provide suitable behavior.

Then, this patch does,

- doesn't recognize "utf8" as "iocharset"
- doesn't use NLS_DEFAULT as default "iocharset"
- instead of NLS_DEFAULT, adds FAT_DEFAULT_CODEPAGE and FAT_DEFAULT_IOCHARSET

NOTE: the following looks like buggy, so it's not recommended

    "codepage=437,iocharset=iso8859-1,utf8"

however, some utf8 file name can handle. (in this case, it uses the table of iso8859-1 for lower <-> upper conversion)

---

 fs/Kconfig     |   19 ++++++++++++
 fs/fat/inode.c |   88 +++++++++++++++++++++++++++++----------------------------
 2 files changed, 65 insertions(+), 42 deletions(-)
fs/Kconfig renamed from fs/Kconfig~fat_default-nls +19 -0
diff -puN fs/Kconfig~fat_default-nls fs/Kconfig
@@ -672,6 +672,25 @@ config VFAT_FS
 	  To compile this as a module, choose M here: the module will be called
 	  vfat.
 
+config FAT_DEFAULT_CODEPAGE
+	int "Default codepage for FAT"
+	depends on MSDOS_FS || VFAT_FS
+	default 437
+	help
+	  This option should be set to the codepage of your FAT filesystems.
+	  It can be overridden with the 'codepage' mount option.
+
+config FAT_DEFAULT_IOCHARSET
+	string "Default iocharset for FAT"
+	depends on VFAT_FS
+	default "iso8859-1"
+	help
+	  Set this to the default I/O character set you'd like FAT to use.
+	  It should probably match the character set that most of your
+	  FAT filesystems use, and can be overridded with the 'iocharset'
+	  mount option for FAT filesystems.  Note that UTF8 is *not* a
+	  supported charset for FAT filesystems.
+
 config UMSDOS_FS
 #dep_tristate '    UMSDOS: Unix-like file system on top of standard MSDOS fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS
 # UMSDOS is temprory broken
fs/fat/inode.c renamed from fs/fat/inode.c~fat_default-nls +46 -42

181 lines not on this page · raw message

_

Signature · 1 line
OGAWA Hirofumi <[email protected]>
#1 lore raw

#include <hallo.h>

Quoted 1 line · OGAWA Hirofumi

Recently, the distributor has set "utf8" to NLS_DEFAULT, therefore,

Excuse my ignorance but I will comment this having things from various HOWTOs in mind.

Quoted 3 lines

FAT uses the "iocharset=utf8" as default. But, since "iocharset=utf8" doesn't provide the function (lower <-> upper conversion) which FAT needs, so FAT can't provide suitable behavior.

I (as user) am completely confused now. I though that "iocharset" was the option to convert the (UCS) VFAT names from Unicode (on disk) to some limited encoding represented the Unix system (eg. ISO-8859-1) and vice versa; but it was limited to single-byte encodings, so "utf8" switch was invented to do direct UCS<->UTF-8 conversion.

Quoted 4 lines

Then, this patch does,

- doesn't recognize "utf8" as "iocharset"
- doesn't use NLS_DEFAULT as default "iocharset"

Is it possible to extend iocharset to allow UCS<->UTF-8 conversion? Wouldn't this make the utf8 switch obsolete?

Quoted 2 lines

- instead of NLS_DEFAULT, adds FAT_DEFAULT_CODEPAGE and FAT_DEFAULT_IOCHARSET

Excuse me, why do you need a special IOCHARSET setting for FAT filesystems? Why should it be different from any other filesystems? Are there any other filesystems except those from MS that support (widechar) Unicode filenames on disk?

Quoted 6 lines

NOTE: the following looks like buggy, so it's not recommended

    "codepage=437,iocharset=iso8859-1,utf8"

however, some utf8 file name can handle. (in this case, it uses the table of iso8859-1 for lower <-> upper conversion)

What do you man with "lower <-> upper"? The letter case? Isn't this a task for the FAT16-names access method?

fs/Kconfig config VFAT_FS · line 681

Quoted 7 lines
fs/Kconfig renamed from fs/Kconfig~fat_default-nls +7 -0
+config FAT_DEFAULT_CODEPAGE
+	int "Default codepage for FAT"
+	depends on MSDOS_FS || VFAT_FS
+	default 437
+	help
+	  This option should be set to the codepage of your FAT filesystems.
+	  It can be overridden with the 'codepage' mount option.

Should describe explicitely that only the short "MS-DOS" names are meant here.

fs/Kconfig config VFAT_FS · line 688

Quoted 6 lines
fs/Kconfig renamed from fs/Kconfig~fat_default-nls +6 -0
+config FAT_DEFAULT_IOCHARSET
+	string "Default iocharset for FAT"
+	depends on VFAT_FS
+	default "iso8859-1"
+	help
+	  Set this to the default I/O character set you'd like FAT to use.

What is the "I/O charset"? The description is completely useless for a user, it does not explain what is converted and where and why and what happens with the data or what is this good for. In contrary, I would think that this is the conversion method from a local encoding to equaly limited I/O encoding.

fs/Kconfig config VFAT_FS · line 692

Quoted 4 lines
fs/Kconfig renamed from fs/Kconfig~fat_default-nls +4 -0
+	  It should probably match the character set that most of your
+	  FAT filesystems use, and can be overridded with the 'iocharset'
+	  mount option for FAT filesystems.  Note that UTF8 is *not* a
+	  supported charset for FAT filesystems.

UTF-8 is not a charset, it is an encoding. Don't mix things together.

Regards,
Eduard.

Signature · 2 lines
Die ganz ganz Schlauen sehen um fünf Ecken - und sind geradeaus blind.
		-- Benjamin Franklin
author maintainer
#2 lore raw
Quoted 8 lines · Eduard Bloch
Quoted 3 lines

FAT uses the "iocharset=utf8" as default. But, since "iocharset=utf8" doesn't provide the function (lower <-> upper conversion) which FAT needs, so FAT can't provide suitable behavior.

I (as user) am completely confused now. I though that "iocharset" was the option to convert the (UCS) VFAT names from Unicode (on disk) to some limited encoding represented the Unix system (eg. ISO-8859-1) and vice versa;

No, iocharset is used for user visible filename.
Is the following enough as example?

user
^ |
| |
<euc-jp> <euc-jp>
| |
------ lookup ---------------- create ------

            |                       |
         <euc-jp>                <euc-jp>
            |                       |
      ["iocharset"]           ["iocharset"]
            |                       |
          <UCS>                   <UCS>
            |                       |
      +-----+-----+            (long name)
      |           |             |        |
["codepage"]      |       ["codepage"]   |
      |           |             |        |
 (8.3 alias) (long name)   (8.3 alias)   |
      ^           ^             |        |
      |           |             V        V
 <shift-jis>    <UCS>     <shift-jis>  <UCS>

------------------------------------------
disk

Quoted 2 lines

but it was limited to single-byte encodings, so "utf8" switch was invented to do direct UCS<->UTF-8 conversion.

No. But multi-byte encodings has some problem on the letter case conversion.

Quoted 7 lines
Quoted 4 lines

Then, this patch does,

- doesn't recognize "utf8" as "iocharset"
- doesn't use NLS_DEFAULT as default "iocharset"

Is it possible to extend iocharset to allow UCS<->UTF-8 conversion? Wouldn't this make the utf8 switch obsolete?

Yes. But I think that we'll need to rewrite the NLS stuff and some part of filesystems.

Quoted 7 lines
Quoted 2 lines

- instead of NLS_DEFAULT, adds FAT_DEFAULT_CODEPAGE and FAT_DEFAULT_IOCHARSET

Excuse me, why do you need a special IOCHARSET setting for FAT filesystems? Why should it be different from any other filesystems? Are there any other filesystems except those from MS that support (widechar) Unicode filenames on disk?

NLS_DEFAULT is used by befs, cifs, vfat, isofs, ncpfs, udf.

Quoted 8 lines
Quoted 6 lines

NOTE: the following looks like buggy, so it's not recommended

    "codepage=437,iocharset=iso8859-1,utf8"

however, some utf8 file name can handle. (in this case, it uses the table of iso8859-1 for lower <-> upper conversion)

What do you man with "lower <-> upper"? The letter case?

Yes. Sorry for my bad English.

Quoted 1 line

Isn't this a task for the FAT16-names access method?

Yes, but 8.3-alias is stored always even if it's long name.

Quoted 10 lines

fs/Kconfig config VFAT_FS · line 681

Quoted 7 lines
fs/Kconfig renamed from fs/Kconfig~fat_default-nls +7 -0
+config FAT_DEFAULT_CODEPAGE
+	int "Default codepage for FAT"
+	depends on MSDOS_FS || VFAT_FS
+	default 437
+	help
+	  This option should be set to the codepage of your FAT filesystems.
+	  It can be overridden with the 'codepage' mount option.

Should describe explicitely that only the short "MS-DOS" names are meant here.

Ok. Any suggestion?

Quoted 4 lines
Quoted 4 lines
fs/Kconfig renamed from fs/Kconfig~fat_default-nls +4 -0
+config FAT_DEFAULT_IOCHARSET
+	string "Default iocharset for FAT"
+	depends on VFAT_FS
+	default "iso8859-1"
Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	help
+	  Set this to the default I/O character set you'd like FAT to use.

What is the "I/O charset"? The description is completely useless for a user, it does not explain what is converted and where and why and what happens with the data or what is this good for. In contrary, I would think that this is the conversion method from a local encoding to equaly limited I/O encoding.

Yes, but it's very old, is widely used in linux filesystems. If it changed, old users may be confused instead.

Quoted 6 lines

fs/Kconfig config VFAT_FS · line 692

Quoted 4 lines
fs/Kconfig renamed from fs/Kconfig~fat_default-nls +4 -0
+	  It should probably match the character set that most of your
+	  FAT filesystems use, and can be overridded with the 'iocharset'
+	  mount option for FAT filesystems.  Note that UTF8 is *not* a
+	  supported charset for FAT filesystems.

UTF-8 is not a charset, it is an encoding. Don't mix things together.

Yes, I'll fix. How about the following?

Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	  supported encoding for FAT filesystems.

Thanks

Signature · 1 line
OGAWA Hirofumi <[email protected]>
author maintainer
#3 lore raw
Quoted 10 lines · OGAWA Hirofumi
Quoted 8 lines
Quoted 6 lines

NOTE: the following looks like buggy, so it's not recommended

    "codepage=437,iocharset=iso8859-1,utf8"

however, some utf8 file name can handle. (in this case, it uses the table of iso8859-1 for lower <-> upper conversion)

Isn't this a task for the FAT16-names access method?

Yes, but 8.3-alias is stored always even if it's long name.

And of course table is also used for case insensible access.

Signature · 1 line
OGAWA Hirofumi <[email protected]>