Function

GLib-2.0GLibfilename_from_utf8

  • Converts a string from UTF-8 to the encoding GLib uses for filenames. Note that on Windows GLib uses UTF-8 for filenames; on other platforms, this function indirectly depends on the current locale.

    The input string shall not contain nul characters even if the len argument is positive. A nul character found inside the string will result in error GLib.ConvertError.ILLEGAL_SEQUENCE. If the filename encoding is not UTF-8 and the conversion output contains a nul character, the error GLib.ConvertError.EMBEDDED_NUL is set and the function returns null.

    Parameters

    • utf8string: string

      a UTF-8 encoded string.

    • len: number

      the length of the string, or -1 if the string is nul-terminated.

    Returns [string, number, number]

    The converted string, or null on an error.