Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #379601

Re: Simple(?) Unicode questions

Path csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: Simple(?) Unicode questions
Date Tue, 12 Dec 2023 19:28:51 -0800
Organization None to speak of
Lines 27
Message-ID <87wmtiwzkc.fsf@nosuchdomain.example.com> (permalink)
References <ul13hl$24kg5$1@dont-email.me> <ulb729$3t0bp$1@dont-email.me>
MIME-Version 1.0
Content-Type text/plain
Injection-Info dont-email.me; posting-host="c34340931401a0293bee67ad839d033e"; logging-data="34025"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190acV50FI30PaExdOJqsD9"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock sha1:TZoOvJ0kyy7EhbBzoqK8woO6Whc= sha1:Q1XOteYeDkrXlKFJW4w4lUP1vpw=
Xref csiph.com comp.lang.c:379601

Show key headers only | View raw


spender <spender@yeah.net> writes:
> printf("%c",ch), the ch must <0xFF, <255
>
> In c lang, The character must be a character of an ASCII table, i.e. <
> (int)255. A string is a collection of characters.
[...]

Not exactly.

C doesn't require ASCII; there are implementations that use EBCDIC, for
example.

The argument corresponding to a "%c" format specifier is of type int,
and is converted to unsigned char.  Conversion to unsigned char is well
defined for values outside the range of unsigned char (the value wraps
around), which can be useful if the argument is a negative char value
promoted to int.

Typically UCHAR_MAX is 255, so the value after conversion will be >= 0
and <= 255 (note "<=", not "<").  Exotic implementations might have
UCHAR_MAX > 255, but such implementations are typically freestanding,
and therefore needn't support printf.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Simple(?) Unicode questions Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2023-12-09 08:04 +0100
  Re: Simple(?) Unicode questions Richard Damon <richard@damon-family.org> - 2023-12-09 08:01 -0500
  Re: Simple(?) Unicode questions jak <nospam@please.ty> - 2023-12-09 15:59 +0100
    Re: Simple(?) Unicode questions Spiros Bousbouras <spibou@gmail.com> - 2023-12-09 15:32 +0000
      Re: Simple(?) Unicode questions jak <nospam@please.ty> - 2023-12-09 18:57 +0100
  Re: Simple(?) Unicode questions Spiros Bousbouras <spibou@gmail.com> - 2023-12-09 15:12 +0000
    Re: Simple(?) Unicode questions Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2023-12-09 17:59 +0100
      Re: Simple(?) Unicode questions Spiros Bousbouras <spibou@gmail.com> - 2023-12-09 17:19 +0000
        Re: Simple(?) Unicode questions Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2023-12-09 18:43 +0100
    Re: Simple(?) Unicode questions Spiros Bousbouras <spibou@gmail.com> - 2023-12-09 17:40 +0000
    Re: Simple(?) Unicode questions Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-12-09 13:46 -0800
  Re: Simple(?) Unicode questions spender <spender@yeah.net> - 2023-12-13 11:05 +0800
    Re: Simple(?) Unicode questions Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2023-12-13 04:24 +0100
    Re: Simple(?) Unicode questions Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-12-12 19:28 -0800
    Re: Simple(?) Unicode questions James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-12-13 00:40 -0500
      Re: Simple(?) Unicode questions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-19 07:43 -0800
    Re: Simple(?) Unicode questions Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2023-12-13 14:56 +0000
      Re: Simple(?) Unicode questions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-12-25 02:03 -0800
        Re: Simple(?) Unicode questions Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-12-25 14:43 -0800
          Re: Simple(?) Unicode questions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-20 09:33 -0800
            Re: Simple(?) Unicode questions Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-01-20 14:19 -0800
              Re: Simple(?) Unicode questions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-24 20:38 -0800

csiph-web