Function

GLibstr_to_ascii

since: 2.40

Declaration [src]

gchar*
g_str_to_ascii (
  const gchar* str,
  const gchar* from_locale
)

Description [src]

Transliterate str to plain ASCII.

For best results, str should be in composed normalised form.

This function performs a reasonably good set of character replacements. The particular set of replacements that is done may change by version or even by runtime environment.

If the source language of str is known, it can used to improve the accuracy of the translation by passing it as from_locale. It should be a valid POSIX locale string (of the form language[_territory][.codeset][modifier]).

If from_locale is NULL then the current locale is used.

If you want to do translation for no specific locale, and you want it to be done independently of the currently locale, specify "C" for from_locale.

Available since: 2.40

Parameters

str

Type: const gchar*

A string, in UTF-8.

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

Type: const gchar*

The source locale, if known.

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

Return value

Type: gchar*

A string in plain ASCII.

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.