I inherited a pretty large C code base that uses Unicode identifiers widely (UTF-8 encoded).
I have to build it with GCC (any version is fine, but I can't recompile it), and I get a lot of error: stray ‘\302’ in program
(763 of these errors).
I cannot simply remove all the Unicode characters because of name collisions.
I cannot use iconv
because a certain amount of characters get translated to ?
that is not valid inside an identifiers (and obviously I cannot replace all ?
to a different character because the code base also use ternary operator widely).
Is there a better way than manually edit every single Unicode character? The best solution would be automatic and reversible (just in case GCC finally start supporting Unicode properly).
Note: I'm aware of the current GCC limitations and of the patch provided, but I cannot rebuild GCC. Moreover what I'm asking for is an automated way to replace all Unicode characters at once (in a revertible way, if possible), not a way to preserve them.