Question: I noticed that the [command line options parser](https://developer.gnome.org/glib/stable/glib-Commandline-option-parser.html) in glib has a type both for a string and a filename. But I assume filenames are just strings.

Is there any practical difference between G\_OPTION\_ARG\_FILENAME and G\_OPTION\_ARG\_STRING or is G\_OPTION\_ARG\_FILENAME just meant to be more descriptive?

Answer: 
`G_OPTION_ARG_STRING` is, more specifically, a string encoded in the current locale's encoding. `G_OPTION_ARG_FILENAME` is a string encoded in the system's filename encoding. These encodings are often both UTF-8 on modern Linux systems, but on some systems they may not be the same.
If you look at the [GLib reference manual](https://developer.gnome.org/glib/unstable/glib-Commandline-option-parser.html#G-OPTION-ARG-FILENAME:CAPS), you'll find the following:

```
G_OPTION_ARG_STRING   the option takes a string argument.
G_OPTION_ARG_FILENAME   the option takes a filename as argument.

```

The encoding of strings and filenames may be different, hence the two options.
Glib uses UTF-8 for strings. The encoding of filenames depends on the operating system but is usually also UTF-8;

> 
> By default, GLib assumes that file names on disk are in UTF-8 encoding. This is a valid assumption for file systems which were created relatively recently: most applications use UTF-8 encoding for their strings, and that is also what they use for the file names they create. However, older file systems may still contain file names created in "older" encodings, such as ISO-8859-1.
> 
> 
> 

The citation is also from the [GLib reference manual](https://developer.gnome.org/glib/stable/glib-Character-Set-Conversion.html).