[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Unicode string literals
From: |
Marc Nieper-Wißkirchen |
Subject: |
Unicode string literals |
Date: |
Thu, 30 Apr 2020 09:51:36 +0200 |
On a system that supports at least C11, I can create an UTF8-encoded
literal string through:
(uint8_t const *) u8"..."
Could Gnulib abstract this into a macro so that substitutes for
systems that do not have u8 string literals can be provided.
On a C11 system, we would have
#define UTF8(s) ((uint8_t const *) u8 ## s)
and similar definitions for UTF16 and UTF32.
Similarly, something like
#define ASCII(s) (u8 ## s [0])
for pre-C2x systems would be nice so that ASCII("c") expands into the
ASCII code point of the character `c'.
- Unicode string literals,
Marc Nieper-Wißkirchen <=