libxfce4util Reference Manual: Unicode Manipulation

## Unicode Manipulation Unicode Manipulation — functions operating on Unicode characters and UTF-8 strings. |

## Functions

gchar * | xfce_utf8_remove_controls ()
gchar * | xfce_utf8_strndup ()

## Includes

    #include <libxfce4util/libxfce4util.h>

## Description

## Functions

### xfce_utf8_remove_controls ()

    gchar *
    xfce_utf8_remove_controls (gchar *str,
                               gssize max_len,
                               const gchar *end);

Removes all control characters from `str` up to `end` or up to `max_len` characters (note that characters does not mean bytes with UTF-8), where both `str` and `max_len` may not be given.

Control characters are replaced in `str` by whitespaces, no new string will be allocated. The operation is done in-place.

#### Parameters

str | target string. |
max_len | max characters to check or -1 for no character limit. |
end | pointer to the endpoint in `str` or `NULL` for no endpoint. |

#### Returns

pointer to `str` or `NULL` on error.

Since 4.2

### xfce_utf8_strndup ()

    gchar *
    xfce_utf8_strndup (const gchar *src,
                       gssize max_len);

Duplicates the `src` string up to `max_len` characters (note that characters does not mean bytes with UTF-8).

The caller is responsible to free the returned string using `g_free()` when no longer needed.

#### Parameters

src | target string. |
max_len | max characters to duplicate or -1 for no character limit. |

#### Returns

pointer to the newly allocated string.

Since 4.3

## Types and Values

## See Also

Glib Unicode Manipulation