wctrans(3)

wctrans3

Wide character mapping functions

Usage

#include <wctype.h>

wint_t

towctrans(wint_t wc, wctrans_t desc);

wctrans_t

wctrans(const char *charclass);

Library

Standard C Library (libc, -lc)

Overview

The wctrans() function returns a value of type wctrans_t which represents the requested wide character mapping operation and may be used as the second argument for calls to towctrans().

The following character mapping names are recognised:

tolowertoupper

The towctrans() function transliterates the wide character wc according to the mapping described by desc.

Return values

The towctrans() function returns the transliterated character if successful, otherwise it returns the character unchanged and sets errno.

The wctrans() function returns non-zero if successful, otherwise it returns zero and sets errno.

Examples

Reimplement towupper() in terms of towctrans() and wctrans():

wint_t
mytowupper(wint_t wc)
{
	return (towctrans(wc, wctrans("toupper")));
}

Errors

The towctrans() function will fail if:

[EINVAL]

The supplied desc argument is invalid.

The wctrans() function will fail if:

[EINVAL]

The requested mapping name is invalid.

Releases

56 releases since FreeBSD 5.0-RELEASE; the text changed 32 times.

  1. 5.0–6.3
  2. 6.4
  3. 7.0
  4. 7.1
  5. 7.2
  6. 7.3
  7. 7.4
  8. 8.0
  9. 8.1
  10. 8.2
  11. 8.3
  12. 8.4
  13. 9.0
  14. 9.1
  15. 9.2
  16. 9.3
  17. 10.0
  18. 10.1
  19. 10.2
  20. 10.3
  21. 10.4
  22. 11.0
  23. 11.1
  24. 11.2
  25. 11.3
  26. 11.4
  27. 12.0
  28. 12.1
  29. 12.2
  30. 12.3
  31. 12.4
  32. 13.0–13.2
  33. 13.3–16.0

Standards

The towctrans() and wctrans() functions conform to IEEE Std 1003.1-2001 (“POSIX.1”).

History

The towctrans() and wctrans() functions first appeared in FreeBSD 5.0.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.