This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug localedata/22073] charmaps/UTF-8: wcwidth of U+00AD (soft hyphen): 0 or 1 ?
- From: "tg at mirbsd dot de" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 04 Sep 2017 16:48:44 +0000
- Subject: [Bug localedata/22073] charmaps/UTF-8: wcwidth of U+00AD (soft hyphen): 0 or 1 ?
- Auto-submitted: auto-generated
- References: <bug-22073-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=22073
--- Comment #4 from Thorsten Glaser <tg at mirbsd dot de> ---
> When writing a curses/terminfo (terminal) application, one goes through
> input and determines the width of text by iterating through the input
> characters. If a word contains multiple U+00AD characters, at the end of
> the line or not, the total width of the word ends up wrong if wcwidth is
> set to 1. Therefore wcwidth(U+00AD) should return 0.
In your reading, everything but the conclusion is* correct.
*) if the application uses the soft hyphen char as soft hyphen
Basically, if the application decides U+00AD is expanded into a hyphen,
it must send a hyphen, NOT U+00AD, to the terminal, and if not, it must
sende no character to the terminal.
The reason here is that wcwidth() is the _width of the character ON THE
TERMINAL_ and not for use within the application. No terminal will break
on the soft hyphen, they’ll all break only at the last column in the
line; therefore, wcwidth of U+00AD *must* be 1.
Further reasons: compatibility with previous wcwidth implementations,
and that the first 256 chars are supposed to be latin1 which had a
wcwidth of 1 for all non-control characters (20‥7E, A0‥FF).
--
You are receiving this mail because:
You are on the CC list for the bug.