Function

GLib-2.0GLiblocale_to_utf8

  • Converts a string which is in the encoding used for strings by the C runtime (usually the same as that used by the operating system) in the current locale into a UTF-8 string.

    If the source 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. If the source encoding is UTF-8, an embedded nul character is treated with the GLib.ConvertError.ILLEGAL_SEQUENCE error for backward compatibility with earlier versions of this library. Use g_convert() to produce output that may contain embedded nul characters.

    Parameters

    • opsysstring: string | Uint8Array<ArrayBufferLike>

      a string in the encoding of the current locale. On Windows this means the system codepage.

    Returns [string, number, number]

    The converted string, or null on an error.