| 1 |
'\" t |
| 2 |
.\" Copyright, Bruno Haible <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
.\" |
| 7 |
.TH wcwidth 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
wcwidth \- determine columns needed for a wide character |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */" |
| 16 |
.B #include <wchar.h> |
| 17 |
.P |
| 18 |
.BI "int wcwidth(wchar_t " wc ); |
| 19 |
.fi |
| 20 |
.SH DESCRIPTION |
| 21 |
The |
| 22 |
.BR wcwidth () |
| 23 |
function returns the number of columns |
| 24 |
needed to represent the wide character |
| 25 |
.IR wc . |
| 26 |
If |
| 27 |
.I wc |
| 28 |
is a printable wide character, the value |
| 29 |
is at least 0. |
| 30 |
If |
| 31 |
.I wc |
| 32 |
is null wide character (L\[aq]\[rs]0\[aq]), the value is 0. |
| 33 |
Otherwise, \-1 is returned. |
| 34 |
.SH RETURN VALUE |
| 35 |
The |
| 36 |
.BR wcwidth () |
| 37 |
function returns the number of |
| 38 |
column positions for |
| 39 |
.IR wc . |
| 40 |
.SH ATTRIBUTES |
| 41 |
For an explanation of the terms used in this section, see |
| 42 |
.BR attributes (7). |
| 43 |
.TS |
| 44 |
allbox; |
| 45 |
lbx lb lb |
| 46 |
l l l. |
| 47 |
Interface Attribute Value |
| 48 |
T{ |
| 49 |
.na |
| 50 |
.nh |
| 51 |
.BR wcwidth () |
| 52 |
T} Thread safety MT-Safe locale |
| 53 |
.TE |
| 54 |
.SH STANDARDS |
| 55 |
POSIX.1-2008. |
| 56 |
.SH HISTORY |
| 57 |
POSIX.1-2001. |
| 58 |
.P |
| 59 |
Note that before glibc 2.2.5, glibc used the prototype |
| 60 |
.P |
| 61 |
.nf |
| 62 |
.BI "int wcwidth(wint_t " wc ); |
| 63 |
.fi |
| 64 |
.SH NOTES |
| 65 |
The behavior of |
| 66 |
.BR wcwidth () |
| 67 |
depends on the |
| 68 |
.B LC_CTYPE |
| 69 |
category of the |
| 70 |
current locale. |
| 71 |
.SH SEE ALSO |
| 72 |
.BR iswprint (3), |
| 73 |
.BR wcswidth (3) |