Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #164674
| From | James Kuyper <jameskuyper@alumni.caltech.edu> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: UTF-8 strings in C |
| Date | 2022-01-27 11:08 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <ssug22$pd6$1@dont-email.me> (permalink) |
| References | (7 earlier) <87h7a6h0lp.fsf@tigger.extechop.net> <srtvd7$143n0$2@solani.org> <87k0es9kag.fsf@tigger.extechop.net> <mblen-20220122163758@ram.dialup.fu-berlin.de> <87k0elpg4l.fsf@tigger.extechop.net> |
On 1/27/22 06:33, Otto J. Makela wrote: > ram@zedat.fu-berlin.de (Stefan Ram) wrote: > >> Here: > > The end result is exactly the same as with my program, > mblen() returns -1. > > James Kuyper <jameskuyper@alumni.caltech.edu> understood it, I need to > ask for the default locale. I'm a bit stumped as to why so. Note: while I referred to it as the "default" locale, that's a bad term for it, since the "C" locale is the true default: "At program startup, the equivalent of setlocale(LC_ALL, "C"); is executed." (7.11.1.1p4) "... a value of "" for locale specifies the locale-specific native environment." (7.11.1.1p3), so it would be better to call it the "native" locale. "In the "C" locale, isalpha returns true only for the characters for which isupper or islower is true." (7.4.1.2p2) "In the "C" locale, islower returns true only for the lowercase letters (as defined in 5.2.1)." (7.4.1.7p2) "In the "C" locale, isupper returns true only for the uppercase letters (as defined in 5.2.1)." (7.4.1.11p2) "... the 26 _uppercase letters_ of the Latin alphabet A B C D E F G H I J K L M N O P Q R S T U V W X Y Z the 26 _lowercase letters_ of the Latin alphabet a b c d e f g h i j k l m n o p q r s t u v w x y z" (5.2.1p2) Note that the phrases "uppercase letters" and "lowercase letters" are in italics, an ISO convention indicating that the clause in which they appear constitutes the official definition for those terms within this document. Thus, isalpha() can only be true in the "C" locale for the 26 letters of the latin alphabet. That's not quite the same as requiring that those be the only valid character encodings. Note, in particular, that it's not possible to pass a member of the extended character set to isalpha() if that member's encoding takes more than 1 byte, so nothing the standard says about isalpha() can constrain how such characters are treated. Such a character could be converted to wchar_t and passed to iswalpha(), but that function has no special specifications for the "C" locale. However, those facts certainly don't encourage support for additional valid character encodings in the "C" locale.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: UTF-8 strings in C Bonita Montero <Bonita.Montero@gmail.com> - 2022-01-10 07:17 +0100
Re: UTF-8 strings in C Mateusz Viste <mateusz@xyz.invalid> - 2022-01-10 09:32 +0100
Re: UTF-8 strings in C Bonita Montero <Bonita.Montero@gmail.com> - 2022-01-10 11:26 +0100
Re: UTF-8 strings in C Bonita Montero <Bonita.Montero@gmail.com> - 2022-01-10 11:55 +0100
Re: UTF-8 strings in C Bonita Montero <Bonita.Montero@gmail.com> - 2022-01-10 14:38 +0100
Re: UTF-8 strings in C om@iki.fi (Otto J. Makela) - 2022-01-14 14:26 +0200
Re: UTF-8 strings in C om@iki.fi (Otto J. Makela) - 2022-01-14 16:07 +0200
Re: UTF-8 strings in C Bonita Montero <Bonita.Montero@gmail.com> - 2022-01-14 15:42 +0100
Re: UTF-8 strings in C Philipp Klaus Krause <pkk@spth.de> - 2022-01-15 09:08 +0100
Re: UTF-8 strings in C om@iki.fi (Otto J. Makela) - 2022-01-22 11:44 +0200
Re: UTF-8 strings in C Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2022-01-22 04:48 -0800
Re: UTF-8 strings in C Richard Damon <Richard@Damon-Family.org> - 2022-01-22 08:27 -0500
Re: UTF-8 strings in C James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-01-22 14:25 -0500
Re: UTF-8 strings in C om@iki.fi (Otto J. Makela) - 2022-01-27 13:32 +0200
Re: UTF-8 strings in C om@iki.fi (Otto J. Makela) - 2022-01-27 13:33 +0200
Re: UTF-8 strings in C James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-01-27 11:08 -0500
Re: UTF-8 strings in C Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-02-03 22:23 -0800
Re: UTF-8 strings in C Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2022-01-14 04:41 -0800
Re: UTF-8 strings in C Bonita Montero <Bonita.Montero@gmail.com> - 2022-01-14 14:43 +0100
Re: UTF-8 strings in C Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2022-01-14 05:45 -0800
Re: UTF-8 strings in C Mateusz Viste <mateusz@xyz.invalid> - 2022-01-14 15:10 +0100
Re: UTF-8 strings in C Bonita Montero <Bonita.Montero@gmail.com> - 2022-01-14 15:43 +0100
Re: UTF-8 strings in C Bart <bc@freeuk.com> - 2022-01-14 15:50 +0000
Re: UTF-8 strings in C Bonita Montero <Bonita.Montero@gmail.com> - 2022-01-14 17:50 +0100
Re: UTF-8 strings in C Mateusz Viste <mateusz@xyz.invalid> - 2022-01-14 17:17 +0100
Re: UTF-8 strings in C Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2022-01-14 08:34 -0800
Re: UTF-8 strings in C Mateusz Viste <mateusz@xyz.invalid> - 2022-01-14 17:42 +0100
Re: UTF-8 strings in C Bonita Montero <Bonita.Montero@gmail.com> - 2022-01-14 17:51 +0100
Re: UTF-8 strings in C Mateusz Viste <mateusz@xyz.invalid> - 2022-01-14 18:07 +0100
Re: UTF-8 strings in C Bonita Montero <Bonita.Montero@gmail.com> - 2022-01-14 18:19 +0100
Re: UTF-8 strings in C Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-02-07 09:02 -0800
csiph-web