From 16aa61efb509a30d4353b7c6a219ceebe9138156 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Tue, 8 Jul 2025 15:34:00 +0200 Subject: Fluid: Fix include guard between 0 and 127 if the UCS is not a number or letter --- fluid/io/Code_Writer.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fluid/io/Code_Writer.cxx b/fluid/io/Code_Writer.cxx index 8bcef2f33..7f265bafa 100644 --- a/fluid/io/Code_Writer.cxx +++ b/fluid/io/Code_Writer.cxx @@ -659,12 +659,12 @@ int Code_Writer::write_code(const char *s, const char *t, bool to_codeview) { macro_name << '_'; while (a < b) { ucs = fl_utf8decode(a, b, &len); - if ((ucs == '.') || (ucs == '_')) { - macro_name << '_'; - } else if (ucs > 0x0000ffff) { // large unicode character + if (ucs > 0x0000ffff) { // large unicode character macro_name << "\\U" << std::setw(8) << std::setfill('0') << std::hex << ucs; - } else if ((ucs > 127) || !isalnum(ucs)) { // small unicode character or not an ASCI letter or digit + } else if (ucs > 127) { // small unicode character or not an ASCI letter or digit macro_name << "\\u" << std::setw(4) << std::setfill('0') << std::hex << ucs; + } else if (!isalnum(ucs)) { + macro_name << '_'; } else { macro_name << (char)ucs; } -- cgit v1.2.3