UTF-8: ELinks assumes towlower uses UCS-4

Kalle Olavi Niemitalo <[email protected]>
Newsgroups gmane.comp.web.links
Message-ID <[email protected]>
src/viewer/text/search.c (lowered_string):

#if defined(CONFIG_UTF_8) && defined(HAVE_WCTYPE_H)
			ret[textlen] = utf8 ? towlower(ret[textlen]) : tolower(ret[textlen]);
#else
			ret[textlen] = tolower(ret[textlen]);
#endif

If CONFIG_UTF_8 is defined, then ret[textlen] is unicode_val_T.
ELinks assumes towlower will convert it to the corresponding
lower-case unicode_val_T.  However, towlower is specified to work
with wchar_t, which does not have to be UCS-4.  In Windows, it
is UTF-16; and in NetBSD, it apparently depends on the locale:
<http://mail.nl.linux.org/linux-utf8/2001-06/msg00074.html>
<ftp://ftp.itojun.org/pub/paper/itojun-freenix2001-presen.ps.gz>

If __STDC_ISO_10646__ is defined, that means any Unicode
character number that fits in wchar_t will be treated as Unicode,
regardless of locale.  But if it is not defined, then Unicode
support may depend on the locale if it even exists at all.
So ELinks cannot portably use towlower for Unicode in that case.
In one of my recent patches, I added a unicode_fold_label_case
function that could perhaps be used here (in which case, it
should also be renamed).

_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
signature.asc (application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFE1cO0Hm9IGt60eMgRAmrLAKDFGaN+W5bLYcQWQHUKOpHMhUrRJACfUL1k
+O9w24bZIE1CV+7U/5IDfps=
=2hzj
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.