I have a list of character definitions, like this:
#define MYCHAR_1 0xC3
#define MYCHAR_2 0xB6
(These are the two bytes that form the UTF-8 character "ö")
Is it possible to create a macro that takes the prefix (in this example "MYCHAR") and yields the string "\xC3\xB6"? (i.e. "ö")
In other words can the C-preprocessor create a static string (or array) out of static array-elements?
The end result should be usable by a function that has a string as parameter, for example:
printf(MY_MAGIC_MACRO(MYCHAR));
should print "ö".
char ouml[] = { MYCHAR_1, MYCHAR_2, 0 };unsigned charfor UTF-8 characters; eithersigned charor plaincharis also correct, usable, etc. However, in all respects except standard library support,unsigned charwill be easier than a possibly (or definitely) signedcharrepresentation.