mirror of https://github.com/OpenTTD/OpenTTD
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 :)pull/8282/head
parent
b14e3b9b9d
commit
68f9925cd4
|
@ -26,14 +26,14 @@
|
|||
* | | | | | | | */
|
||||
/** The original currency specifications. */
|
||||
static const CurrencySpec origin_currency_specs[CURRENCY_END] = {
|
||||
{ 1, "", CF_NOEURO, "\xC2\xA3", "", 0, STR_GAME_OPTIONS_CURRENCY_GBP }, ///< british pound
|
||||
{ 1, "", CF_NOEURO, u8"\u00a3", "", 0, STR_GAME_OPTIONS_CURRENCY_GBP }, ///< british pound
|
||||
{ 2, "", CF_NOEURO, "$", "", 0, STR_GAME_OPTIONS_CURRENCY_USD }, ///< american dollar
|
||||
{ 2, "", CF_ISEURO, "\xE2\x82\xAC", "", 0, STR_GAME_OPTIONS_CURRENCY_EUR }, ///< euro
|
||||
{ 220, "", CF_NOEURO, "\xC2\xA5", "", 0, STR_GAME_OPTIONS_CURRENCY_JPY }, ///< japanese yen
|
||||
{ 2, "", CF_ISEURO, u8"\u20ac", "", 0, STR_GAME_OPTIONS_CURRENCY_EUR }, ///< euro
|
||||
{ 220, "", CF_NOEURO, u8"\u00a5", "", 0, STR_GAME_OPTIONS_CURRENCY_JPY }, ///< japanese yen
|
||||
{ 27, "", 2002, "", NBSP "S.", 1, STR_GAME_OPTIONS_CURRENCY_ATS }, ///< austrian schilling
|
||||
{ 81, "", 2002, "BEF" NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_BEF }, ///< belgian franc
|
||||
{ 2, "", CF_NOEURO, "CHF" NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_CHF }, ///< swiss franc
|
||||
{ 41, "", CF_NOEURO, "", NBSP "K\xC4\x8D", 1, STR_GAME_OPTIONS_CURRENCY_CZK }, ///< czech koruna
|
||||
{ 41, "", CF_NOEURO, "", NBSP u8"K\u010d", 1, STR_GAME_OPTIONS_CURRENCY_CZK }, ///< czech koruna
|
||||
{ 4, "", 2002, "DM" NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_DEM }, ///< deutsche mark
|
||||
{ 11, "", CF_NOEURO, "", NBSP "kr", 1, STR_GAME_OPTIONS_CURRENCY_DKK }, ///< danish krone
|
||||
{ 333, "", 2002, "Pts" NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_ESP }, ///< spanish peseta
|
||||
|
@ -45,7 +45,7 @@ static const CurrencySpec origin_currency_specs[CURRENCY_END] = {
|
|||
{ 3873, "", 2002, "", NBSP "L.", 1, STR_GAME_OPTIONS_CURRENCY_ITL }, ///< italian lira
|
||||
{ 4, "", 2002, "NLG" NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_NLG }, ///< dutch gulden
|
||||
{ 12, "", CF_NOEURO, "", NBSP "Kr", 1, STR_GAME_OPTIONS_CURRENCY_NOK }, ///< norwegian krone
|
||||
{ 6, "", CF_NOEURO, "", NBSP "z\xC5\x82", 1, STR_GAME_OPTIONS_CURRENCY_PLN }, ///< polish zloty
|
||||
{ 6, "", CF_NOEURO, "", NBSP u8"z\u0142", 1, STR_GAME_OPTIONS_CURRENCY_PLN }, ///< polish zloty
|
||||
{ 5, "", CF_NOEURO, "", NBSP "Lei", 1, STR_GAME_OPTIONS_CURRENCY_RON }, ///< romanian leu
|
||||
{ 50, "", CF_NOEURO, "", NBSP "p", 1, STR_GAME_OPTIONS_CURRENCY_RUR }, ///< russian rouble
|
||||
{ 479, "", 2007, "", NBSP "SIT", 1, STR_GAME_OPTIONS_CURRENCY_SIT }, ///< slovenian tolar
|
||||
|
@ -55,7 +55,7 @@ static const CurrencySpec origin_currency_specs[CURRENCY_END] = {
|
|||
{ 4, "", CF_NOEURO, "R$" NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_BRL }, ///< brazil real
|
||||
{ 31, "", 2011, "", NBSP "EEK", 1, STR_GAME_OPTIONS_CURRENCY_EEK }, ///< estonian krooni
|
||||
{ 4, "", 2015, "", NBSP "Lt", 1, STR_GAME_OPTIONS_CURRENCY_LTL }, ///< lithuanian litas
|
||||
{ 1850, "", CF_NOEURO, "\xE2\x82\xA9", "", 0, STR_GAME_OPTIONS_CURRENCY_KRW }, ///< south korean won
|
||||
{ 1850, "", CF_NOEURO, u8"\u20a9", "", 0, STR_GAME_OPTIONS_CURRENCY_KRW }, ///< south korean won
|
||||
{ 13, "", CF_NOEURO, "R" NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_ZAR }, ///< south african rand
|
||||
{ 1, "", CF_NOEURO, "", "", 2, STR_GAME_OPTIONS_CURRENCY_CUSTOM }, ///< custom currency (add further languages below)
|
||||
{ 3, "", CF_NOEURO, "", NBSP "GEL", 1, STR_GAME_OPTIONS_CURRENCY_GEL }, ///< Georgian Lari
|
||||
|
@ -63,9 +63,9 @@ static const CurrencySpec origin_currency_specs[CURRENCY_END] = {
|
|||
{ 80, "", CF_NOEURO, "", NBSP "rub", 1, STR_GAME_OPTIONS_CURRENCY_RUB }, ///< New Russian Ruble
|
||||
{ 24, "", CF_NOEURO, "$", "", 0, STR_GAME_OPTIONS_CURRENCY_MXN }, ///< Mexican peso
|
||||
{ 40, "", CF_NOEURO, "NTD" NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_NTD }, ///< new taiwan dollar
|
||||
{ 8, "", CF_NOEURO, "\xC2\xA5", "", 0, STR_GAME_OPTIONS_CURRENCY_CNY }, ///< chinese renminbi
|
||||
{ 8, "", CF_NOEURO, u8"\u00a5", "", 0, STR_GAME_OPTIONS_CURRENCY_CNY }, ///< chinese renminbi
|
||||
{ 10, "", CF_NOEURO, "HKD" NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_HKD }, ///< hong kong dollar
|
||||
{ 90, "", CF_NOEURO, "\xE2\x82\xB9", "", 0, STR_GAME_OPTIONS_CURRENCY_INR }, ///< Indian Rupee
|
||||
{ 90, "", CF_NOEURO, u8"\u20b9", "", 0, STR_GAME_OPTIONS_CURRENCY_INR }, ///< Indian Rupee
|
||||
};
|
||||
|
||||
/** Array of currencies used by the system */
|
||||
|
|
126
src/misc_gui.cpp
126
src/misc_gui.cpp
|
@ -412,69 +412,69 @@ static WindowDesc _about_desc(
|
|||
);
|
||||
|
||||
static const char * const _credits[] = {
|
||||
"Original design by Chris Sawyer",
|
||||
"Original graphics by Simon Foster",
|
||||
"",
|
||||
"The OpenTTD team (in alphabetical order):",
|
||||
" Grzegorz Duczy\xC5\x84ski (adf88) - General coding (since 1.7.2)",
|
||||
" Albert Hofkamp (Alberth) - GUI expert (since 0.7)",
|
||||
" Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)",
|
||||
" Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)",
|
||||
" Christoph Elsenhans (frosch) - General coding (since 0.6)",
|
||||
" Lo\xC3\xAF""c Guilloux (glx) - General / Windows Expert (since 0.4.5)",
|
||||
" Charles Pigott (LordAro) - General / Correctness police (since 1.9)",
|
||||
" Michael Lutz (michi_cc) - Path based signals (since 0.7)",
|
||||
" Niels Martin Hansen (nielsm) - Music system, general coding (since 1.9)",
|
||||
" Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)",
|
||||
" Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)",
|
||||
" Ingo von Borstel (planetmaker) - General, Support (since 1.1)",
|
||||
" Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)",
|
||||
" Jos\xC3\xA9 Soler (Terkhen) - General coding (since 1.0)",
|
||||
" Leif Linse (Zuu) - AI/Game Script (since 1.2)",
|
||||
"",
|
||||
"Inactive Developers:",
|
||||
" Jean-Fran\xC3\xA7ois Claeys (Belugas) - GUI, NewGRF and more (0.4.5 - 1.0)",
|
||||
" Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)",
|
||||
" Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)",
|
||||
" Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)",
|
||||
" Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)",
|
||||
" Attila B\xC3\xA1n (MiHaMiX) - Developer WebTranslator 1 and 2 (0.3 - 0.5)",
|
||||
" Zden\xC4\x9Bk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)",
|
||||
" Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)",
|
||||
" Patric Stout (TrueBrain) - NoAI, NoGo, Network (0.3 - 1.2), sys op (active)",
|
||||
" Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)",
|
||||
"",
|
||||
"Retired Developers:",
|
||||
" Tam\xC3\xA1s Farag\xC3\xB3 (Darkvater) - Ex-Lead coder (0.3 - 0.5)",
|
||||
" Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)",
|
||||
" Emil Djupfeld (egladil) - MacOSX (0.4.5 - 0.6)",
|
||||
" Simon Sasburg (HackyKid) - Many bugfixes (0.4 - 0.4.5)",
|
||||
" Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)",
|
||||
" Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)",
|
||||
" Petr Baudi\xC5\xA1 (pasky) - Many patches, NewGRF support (0.3 - 0.3)",
|
||||
" Benedikt Br\xC3\xBCggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)",
|
||||
" Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)",
|
||||
"",
|
||||
"Special thanks go out to:",
|
||||
" Josef Drexler - For his great work on TTDPatch",
|
||||
" Marcin Grzegorczyk - Track foundations and for describing TTD internals",
|
||||
" Stefan Mei\xC3\x9Fner (sign_de) - For his work on the console",
|
||||
" Mike Ragsdale - OpenTTD installer",
|
||||
" Christian Rosentreter (tokai) - MorphOS / AmigaOS port",
|
||||
" Richard Kempton (richK) - additional airports, initial TGP implementation",
|
||||
"",
|
||||
" Alberto Demichelis - Squirrel scripting language \xC2\xA9 2003-2008",
|
||||
" L. Peter Deutsch - MD5 implementation \xC2\xA9 1999, 2000, 2002",
|
||||
" Michael Blunck - Pre-signals and semaphores \xC2\xA9 2003",
|
||||
" George - Canal/Lock graphics \xC2\xA9 2003-2004",
|
||||
" Andrew Parkhouse (andythenorth) - River graphics",
|
||||
" David Dallaston (Pikka) - Tram tracks",
|
||||
" All Translators - Who made OpenTTD a truly international game",
|
||||
" Bug Reporters - Without whom OpenTTD would still be full of bugs!",
|
||||
"",
|
||||
"",
|
||||
"And last but not least:",
|
||||
" Chris Sawyer - For an amazing game!"
|
||||
u8"Original design by Chris Sawyer",
|
||||
u8"Original graphics by Simon Foster",
|
||||
u8"",
|
||||
u8"The OpenTTD team (in alphabetical order):",
|
||||
u8" Grzegorz Duczy\u0144ski (adf88) - General coding (since 1.7.2)",
|
||||
u8" Albert Hofkamp (Alberth) - GUI expert (since 0.7)",
|
||||
u8" Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)",
|
||||
u8" Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)",
|
||||
u8" Christoph Elsenhans (frosch) - General coding (since 0.6)",
|
||||
u8" Lo\u00efc Guilloux (glx) - General / Windows Expert (since 0.4.5)",
|
||||
u8" Charles Pigott (LordAro) - General / Correctness police (since 1.9)",
|
||||
u8" Michael Lutz (michi_cc) - Path based signals (since 0.7)",
|
||||
u8" Niels Martin Hansen (nielsm) - Music system, general coding (since 1.9)",
|
||||
u8" Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)",
|
||||
u8" Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)",
|
||||
u8" Ingo von Borstel (planetmaker) - General, Support (since 1.1)",
|
||||
u8" Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)",
|
||||
u8" Jos\u00e9 Soler (Terkhen) - General coding (since 1.0)",
|
||||
u8" Leif Linse (Zuu) - AI/Game Script (since 1.2)",
|
||||
u8"",
|
||||
u8"Inactive Developers:",
|
||||
u8" Jean-Fran\u00e7ois Claeys (Belugas) - GUI, NewGRF and more (0.4.5 - 1.0)",
|
||||
u8" Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)",
|
||||
u8" Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)",
|
||||
u8" Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)",
|
||||
u8" Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)",
|
||||
u8" Attila B\u00e1n (MiHaMiX) - Developer WebTranslator 1 and 2 (0.3 - 0.5)",
|
||||
u8" Zden\u011bk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)",
|
||||
u8" Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)",
|
||||
u8" Patric Stout (TrueBrain) - NoAI, NoGo, Network (0.3 - 1.2), sys op (active)",
|
||||
u8" Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)",
|
||||
u8"",
|
||||
u8"Retired Developers:",
|
||||
u8" Tam\u00e1s Farag\u00f3 (Darkvater) - Ex-Lead coder (0.3 - 0.5)",
|
||||
u8" Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)",
|
||||
u8" Emil Djupfeld (egladil) - MacOSX (0.4.5 - 0.6)",
|
||||
u8" Simon Sasburg (HackyKid) - Many bugfixes (0.4 - 0.4.5)",
|
||||
u8" Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)",
|
||||
u8" Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)",
|
||||
u8" Petr Baudi\u0161 (pasky) - Many patches, NewGRF support (0.3 - 0.3)",
|
||||
u8" Benedikt Br\u00fcggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)",
|
||||
u8" Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)",
|
||||
u8"",
|
||||
u8"Special thanks go out to:",
|
||||
u8" Josef Drexler - For his great work on TTDPatch",
|
||||
u8" Marcin Grzegorczyk - Track foundations and for describing TTD internals",
|
||||
u8" Stefan Mei\u00dfner (sign_de) - For his work on the console",
|
||||
u8" Mike Ragsdale - OpenTTD installer",
|
||||
u8" Christian Rosentreter (tokai) - MorphOS / AmigaOS port",
|
||||
u8" Richard Kempton (richK) - additional airports, initial TGP implementation",
|
||||
u8"",
|
||||
u8" Alberto Demichelis - Squirrel scripting language \u00a9 2003-2008",
|
||||
u8" L. Peter Deutsch - MD5 implementation \u00a9 1999, 2000, 2002",
|
||||
u8" Michael Blunck - Pre-signals and semaphores \u00a9 2003",
|
||||
u8" George - Canal/Lock graphics \u00a9 2003-2004",
|
||||
u8" Andrew Parkhouse (andythenorth) - River graphics",
|
||||
u8" David Dallaston (Pikka) - Tram tracks",
|
||||
u8" All Translators - Who made OpenTTD a truly international game",
|
||||
u8" Bug Reporters - Without whom OpenTTD would still be full of bugs!",
|
||||
u8"",
|
||||
u8"",
|
||||
u8"And last but not least:",
|
||||
u8" Chris Sawyer - For an amazing game!"
|
||||
};
|
||||
|
||||
struct AboutWindow : public Window {
|
||||
|
|
|
@ -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.
|
||||
|
|
1150
src/table/townname.h
1150
src/table/townname.h
File diff suppressed because it is too large
Load Diff
|
@ -359,7 +359,7 @@ static void Xunzip(byte **bufp, size_t *sizep)
|
|||
}
|
||||
|
||||
/* Check for the byte-order-mark, and skip it if needed. */
|
||||
char *p = this->text + (strncmp("\xEF\xBB\xBF", this->text, 3) == 0 ? 3 : 0);
|
||||
char *p = this->text + (strncmp(u8"\ufeff", this->text, 3) == 0 ? 3 : 0);
|
||||
|
||||
/* Make sure the string is a valid UTF-8 sequence. */
|
||||
str_validate(p, this->text + filesize, SVS_REPLACE_WITH_QUESTION_MARK | SVS_ALLOW_NEWLINE);
|
||||
|
|
|
@ -505,7 +505,7 @@ static char *MakeFinnishTownName(char *buf, const char *last, uint32 seed)
|
|||
strstr(orig, "A") != nullptr || strstr(orig, "O") != nullptr || strstr(orig, "U") != nullptr) {
|
||||
buf = strecpy(buf, "la", last);
|
||||
} else {
|
||||
buf = strecpy(buf, "l\xC3\xA4", last);
|
||||
buf = strecpy(buf, u8"l\u00e4", last);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue