towupper(3)
β¨ towupper(3) β bestie edition β¨
okay so this is the manual page for towupper(3), and it's literally about turning wide characters UPPERCASE π
yes it's giving "why is my keyboard yelling" energy but it's actually so useful, trust.
πΈ NAME πΈ
towupper, towupper_l β convert a wide character to uppercase β¨
π LIBRARY π
Standard C library (libc, -lc) β the classic, the icon, the one and only π«Ά
π SYNOPSIS π
#include <wctype.h>
wint_t towupper(wint_t wc);
wint_t towupper_l(wint_t wc, locale_t locale);
π§ Feature Test Macro Requirements for glibc (see feature_test_macros(7)) π§
towupper_l():
- Since glibc 2.10:
_XOPEN_SOURCE >= 700 - Before glibc 2.10:
_GNU_SOURCE
so basically if you're on ancient glibc you gotta hit it with that _GNU_SOURCE, no cap.
π DESCRIPTION π
So towupper() is the wide-character version of toupper(3), like the glow-up edition. If wc is a lowercase wide character, and there's an uppercase equivalent chillin' in the current locale, it hands you the uppercase equivalent of wc. In literally every other case, it just gives you wc back, unchanged, no drama π
towupper_l() does the exact same task, except it does the conversion based on the character type info in the locale you specify with locale. Obsessed with the flexibility ngl.
β οΈ But watch out bestie: the behavior oftowupper_l()is undefined iflocaleis that special locale objectLC_GLOBAL_LOCALE(peepduplocale(3)) or if it's not a valid locale object handle. Undefined. Behavior. Not it. π
Also the argument wc must be representable as a wchar_t and be a valid character in the locale, or just be the value WEOF. Like those are the rules, periodt.
π₯ RETURN VALUE π₯
If wc was convertible to uppercase, towupper() returns its uppercase equivalent. Otherwise it returns wc. Simple as that, main character behavior honestly π
β ATTRIBUTES β
For the explanation of the terms used in this section, see attributes(7).
towupper()β Thread safety:MT-Safe localetowupper_l()β Thread safety:MT-Safe
both of them ate, no crumbs π
π STANDARDS π
towupper()β C11, POSIX.1-2008 (XSI).towupper_l()β POSIX.1-2008.
π¦ HISTORY π¦
towupper()β C99, POSIX.1-2001 (XSI). Obsolete in POSIX.1-2008 (XSI). π rip bestie, you had a good run.towupper_l()β POSIX.1-2008. glibc 2.3.
π NOTES π
The behavior of these functions depends on the LC_CTYPE category of the locale, so yeah, locale settings are literally running the show.
Also β and this is kinda important β these functions are not very appropriate for dealing with Unicode characters, because Unicode knows about three cases: upper, lower, and title case. Three. Not two. So like, if you're doing Unicode stuff, this is lowkey not the vibe π« (iykyk)
π SEE ALSO π
iswupper(3), towctrans(3), towlower(3), locale(7)
anyway that's the whole page bestie, go forth and uppercase responsibly πβ¨
Linux man-pages 6.20 β dated 2026-02-08 β and that's the towupper(3) page, signed, sealed, slayed π
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-2.0-or-later
- Copyright 2014, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms