Function

GLibWin32locale_filename_from_utf8

since: 2.8

Declaration [src]

gchar*
g_win32_locale_filename_from_utf8 (
  const gchar* utf8filename
)

Description [src]

Converts a filename from UTF-8 to the system codepage.

On NT-based Windows, on NTFS file systems, file names are in Unicode. It is quite possible that Unicode file names contain characters not representable in the system codepage. (For instance, Greek or Cyrillic characters on Western European or US Windows installations, or various less common CJK characters on CJK Windows installations.)

In such a case, and if the filename refers to an existing file, and the file system stores alternate short (8.3) names for directory entries, the short form of the filename is returned. Note that the “short” name might in fact be longer than the Unicode name if the Unicode name has very short pathname components containing non-ASCII characters. If no system codepage name for the file is possible, NULL is returned.

The return value is dynamically allocated and should be freed with g_free() when no longer needed.

Available since: 2.8

Parameters

utf8filename

Type: const gchar*

A UTF-8 encoded filename.

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Return value

Type: gchar*

The converted filename, or NULL on conversion failure and lack of short names.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.