Linux – UTF 8 filenames

filenameslinuxunicode

In unix based operating systems are utf6 filenames permissible? If so do I need to do anything special to write the file to disk.

Let me explain what I'm hoping to do. I'm writing an application that will transfer a file via ftp to a remote system but the filename is dynamically set to via some set of meta data which potentially could be in utf8. I'm wondering if there's something I need to do to write the file to disk in unix/linux.

Also as a follow up does anyone know what would happen if I did upload a utf 8 filename to a system doesn't support utf8?

Best Answer

On Unix/Linux, a filename is a sequence of any bytes except for a slash or a NUL. A slash separates path components, and a NUL terminates a path name.

So, you can use whatever encoding you want for filenames. Some applications may have trouble with some encodings if they are naïve about what characters may be in filenames - for example, poorly-written shell scripts often do not handle filenames with spaces.

Modern Unix/Linux environments handle UTF-8 encoded filenames just fine.

Related Question