Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know character encoding of file names depending on the filesystem

I would like to know the character encoding of the file names in a filesystem in order to display correctly them in a GUI.

How should I do this ?

I suppose I get different character encoding depending on the file system (FAT, NTFS, ext3, etc.)

Thank you

(I work in C++ but this topic is not language related)

like image 572
user803422 Avatar asked Sep 02 '12 15:09

user803422


Video Answer


1 Answers

NTFS is Unicode (UTF-16). exFAT is Unicode as well.

Original FAT and fAT32 use OEM character set (read more on MSDN).

On Linux and Unix filename may contain any bytes except NUL and the charater set is not defined. Consequently each application decides itself which one to use. Many applications use UTF8. See more in this question.

The above unix approach is used on most filesystems (mainly because the "charset" concept has more meaning on the OS level than on the storage level). You can check FS capabilities and requirements regarding filename characters here (table 2 column 3).

like image 136
Eugene Mayevski 'Callback Avatar answered Oct 02 '22 12:10

Eugene Mayevski 'Callback