From 0b5b919352bf02237f5eb78756629d49fef95d40 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 17 May 2021 12:42:45 +0200 Subject: [PATCH] - let the CSV parser for the string table handle hex escapes. --- src/common/engine/stringtable.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/common/engine/stringtable.cpp b/src/common/engine/stringtable.cpp index eea149ef090..c983afc3788 100644 --- a/src/common/engine/stringtable.cpp +++ b/src/common/engine/stringtable.cpp @@ -513,8 +513,30 @@ size_t FStringTable::ProcessEscapes (char *iptr) c = '\r'; else if (c == 't') c = '\t'; + else if (c == 'x') + { + c = 0; + for (int i = 0; i < 2; i++) + { + char cc = *iptr++; + if (cc >= '0' && cc <= '9') + c = (c << 4) + cc - '0'; + else if (cc >= 'a' && cc <= 'f') + c = (c << 4) + 10 + cc - 'a'; + else if (cc >= 'A' && cc <= 'F') + c = (c << 4) + 10 + cc - 'A'; + else + { + iptr--; + break; + } + } + if (c == 0) continue; + } else if (c == '\n') continue; + + } *optr++ = c; }