[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unicode string literals
From: |
Marc Nieper-Wißkirchen |
Subject: |
Re: Unicode string literals |
Date: |
Thu, 30 Apr 2020 23:05:32 +0200 |
Am Do., 30. Apr. 2020 um 22:54 Uhr schrieb Paul Eggert <address@hidden>:
>
> On 4/30/20 6:08 AM, Bruno Haible wrote:
> > These not-so-new compilers don't perform
> > character set conversion; you have to provide the numeric value of each
> > byte yourself (either as escapes, or by enumerating the bytes of the
> > string one by one).
>
> Could we have a macro to be used only in source code encoded via UTF-8?
> Presumably the older compilers would process the bytes of the string as if
> they
> were individual 8-bit characters and would pass them through unchanged, so the
> run-time string would be UTF-8 too.
This would allow writing a macro that prefixes "u8" to strings in
compilers supporting enough of C11, skipping the prefix in compilers
that pass UTF-8 encoded bytes in strings unchanged and signal an error
in all other cases (hopefully only very exotic platforms), right?