diff options
author | Patric Stout <truebrain@openttd.org> | 2020-12-14 20:25:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-14 20:25:01 +0100 |
commit | 68f9925cd4c8b29dbdac301e86bd9fc6f5a7fb27 (patch) | |
tree | 7089a650e6372e6ea37b3d6a60e9359e19120ae1 /src/string_type.h | |
parent | b14e3b9b9df2294e1f0b7fab8b2c23381e32ade7 (diff) | |
download | openttd-68f9925cd4c8b29dbdac301e86bd9fc6f5a7fb27.tar.xz |
Codechange: use \u to indicate unicode chars in strings (#8379)
With \x, we sometimes had to do the "" trick, as the length is not
predefined. With C++11 bringing \u to the specs, which has a preset
length, we no longer need the "" trick.
We set the strings to u8, to ensure all compilers use UTF-8 encoding
for the \u characters.
This was triggered by newer CLangs, which start to warn if you
use "" in the middle of a string, wondering if that was your
intention. It is a good question. And this is our answer :)
Diffstat (limited to 'src/string_type.h')
-rw-r--r-- | src/string_type.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/string_type.h b/src/string_type.h index 623d74661..25ea65598 100644 --- a/src/string_type.h +++ b/src/string_type.h @@ -15,10 +15,10 @@ #include <string> /** A non-breaking space. */ -#define NBSP "\xC2\xA0" +#define NBSP u8"\u00a0" /** A left-to-right marker, marks the next character as left-to-right. */ -#define LRM "\xE2\x80\x8E" +#define LRM u8"\u200e" /** * Valid filter types for IsValidChar. |