- unescape special html entities when pulling down lng files from transifex

- do not show pw when showing ini settings on commandline
This commit is contained in:
Mark Vejvoda 2012-10-22 20:05:42 +00:00
parent ba0bf98b9e
commit 57d0104c01
4 changed files with 75 additions and 2 deletions

View File

@ -2587,7 +2587,12 @@ void ShowINISettings(int argc, char **argv,Config &config,Config &configKeys) {
printf("\t");
}
printf("Value [%s]\n",nameValue.second.c_str());
string displayValue = nameValue.second;
if(nameValue.first == "TranslationGetURLPassword") {
displayValue = "*****";
}
printf("Value [%s]\n",displayValue.c_str());
}
}

View File

@ -1241,7 +1241,8 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
replaceAll(fileData,"\\n","\n");
replaceAll(fileData,"$requires-newline$","\\n");
replaceAll(fileData,""","\"");
//replaceAll(fileData,""","\"");
replaceAllHTMLEntities(fileData);
printf("PARSED Language text\n[%s]\n",fileData.c_str());

View File

@ -224,6 +224,7 @@ void trimPathWithStartingSlash(string &path);
void updatePathClimbingParts(string &path);
string formatPath(string path);
string replaceAllHTMLEntities(string& context);
string replaceAll(string& context, const string& from, const string& to);
vector<char> replaceAllBetweenTokens(vector<char>& context, const string &startToken, const string &endToken, const string &newText, bool removeTokens=true);
string replaceAllBetweenTokens(string& context, const string &startToken, const string &endToken, const string &newText, bool removeTokens=true);

View File

@ -1795,6 +1795,72 @@ bool isKeyDown(int virtualKey) {
return false;
}
string replaceAllHTMLEntities(string& context) {
// quotation mark = APL quote &quot; &#34; &#x22; " " "
// ampersand &amp; &#38; &#x26; & & &
// less-than sign &lt; &#60; &#x3C; < < <
// greater-than sign &gt; &#62; &#x3E; > > >
// Latin capital ligature OE &OElig; &#338; &#x152; Œ Œ Œ
// Latin small ligature oe &oelig; &#339; &#x153; œ œ œ
// Latin capital letter S with caron &Scaron; &#352; &#x160; Š Š Š
// Latin small letter s with caron &scaron; &#353; &#x161; š š š
// Latin capital letter Y with diaeresis &Yuml; &#376; &#x178; Ÿ Ÿ Ÿ
// modifier letter circumflex accent &circ; &#710; &#x2C6; ˆ ˆ ˆ
// small tilde &tilde; &#732; &#x2DC; ˜ ˜ ˜
// en space &ensp; &#8194; &#x2002;
// em space &emsp; &#8195; &#x2003;
// thin space &thinsp; &#8201; &#x2009;
// zero width non-joiner &zwnj; &#8204; &#x200C;
// zero width joiner &zwj; &#8205; &#x200D;
// left-to-right mark &lrm; &#8206; &#x200E;
// right-to-left mark &rlm; &#8207; &#x200F;
// en dash &ndash; &#8211; &#x2013;
// em dash &mdash; &#8212; &#x2014; — — —
// left single quotation mark &lsquo; &#8216; &#x2018;
// right single quotation mark &rsquo; &#8217; &#x2019;
// single low-9 quotation mark &sbquo; &#8218; &#x201A;
// left double quotation mark &ldquo; &#8220; &#x201C; “ “ “
// right double quotation mark &rdquo; &#8221; &#x201D; ” ” ”
// double low-9 quotation mark &bdquo; &#8222; &#x201E; „ „ „
// dagger &dagger; &#8224; &#x2020; † † †
// double dagger &Dagger; &#8225; &#x2021; ‡ ‡ ‡
// per mille sign &permil; &#8240; &#x2030; ‰ ‰ ‰
// single left-pointing angle quotation mark &lsaquo; &#8249; &#x2039;
// single right-pointing angle quotation mark &rsaquo; &#8250; &#x203A;
// euro sign &euro; &#8364; &#x20AC; € € €
replaceAll(context,"&quot;","\"");
replaceAll(context,"&amp;","&");
replaceAll(context,"&lt;","<");
replaceAll(context,"&gt;",">");
replaceAll(context,"&OElig;","Œ");
replaceAll(context,"&oelig;","œ");
replaceAll(context,"&Scaron;","Š");
replaceAll(context,"&scaron;","š");
replaceAll(context,"&Yuml;","Ÿ");
replaceAll(context,"&circ;","ˆ");
replaceAll(context,"&tilde;","˜");
replaceAll(context,"&ensp;"," ");
replaceAll(context,"&emsp;"," ");
replaceAll(context,"&thinsp;"," ");
replaceAll(context,"&ndash;","-");
replaceAll(context,"&mdash;","-");
replaceAll(context,"&lsquo;","");
replaceAll(context,"&rsquo;","");
replaceAll(context,"&sbquo;","");
replaceAll(context,"&ldquo;","");
replaceAll(context,"&rdquo;","");
replaceAll(context,"&bdquo;","");
replaceAll(context,"&dagger;","");
replaceAll(context,"&Dagger;","");
replaceAll(context,"&permil;","");
replaceAll(context,"&lsaquo;","");
replaceAll(context,"&rsaquo;","");
replaceAll(context,"&euro;","");
return context;
}
string replaceAll(string& context, const string& from, const string& to) {
size_t lookHere = 0;
size_t foundHere = 0;