wctrans(), towctrans() — Transliterate wide character

Standards

Standards / Extensions C or C++ Dependencies

ISO C Amendment
C99
Single UNIX Specification, Version 3

both  

Format

#include <wchar.h>

			wctrans_t  wctrans(const char * charclass); 
			wint_t 	 towctrans(wint_t wc, wctrans_t desc);
			

General description

These two functions work together to provide transliteration of wide characters. For valid results, the setting of the LC_CTYPE category of the current locale must remain the same across the two calls. Character mapping rules are defined in the LC_CTYPE category.

The wctrans() function takes the character mapping name pointed to by charclass and returns a value of type wctrans_t for use as the second argument to the towctrans() function.

The towctrans() function applies the indicated mapping to wide-character code wc from the codeset identified in the current locale. The towctrans() function applies the mapping returned by wctrans() and passed as desc.

The following character mapping names are reserved by the standard and are defined in all locales: tolower and toupper.

Notes:
  1. towctrans(wc, wctrans("tolower")) is equivalent to towlower(wc)
  2. towctrans(wc, wctrans("toupper")) is equivalent to towupper(wc)

Returned value

If successful, wctrans() returns the non-zero value of type wctrans_t for use in calls to towctrans().

If unsuccessful, wctrans() returns 0 and sets errno to EINVAL if the mapping name pointed to by charclass is not valid for the current locale.

If successful, the towctrans() function returns the mapped value of wc using the mapping described by desc.

If unsuccessful, towctrans() returns wc unchanged. If the value of desc is invalid, towctrans() returns 0.

Related information