Skip to content

Commit

Permalink
RFX_StringUtils.cpp: fix   and ♥
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Jul 4, 2019
1 parent 5c602d4 commit 8975d1a
Showing 1 changed file with 60 additions and 58 deletions.
118 changes: 60 additions & 58 deletions Helpers/RFX_StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,15 @@ string strToAscii(string& s)
{
#define ascii_conv(a,b) else if (s[i] == a) s[i] = b;
#ifdef _WIN32
strReplace(s, "\xC4", "Ae"); // Ä
strReplace(s, "\xD6", "Oe"); // Ö
strReplace(s, "\xDC", "Ue"); // Ü
strReplace(s, "\xC6", "Ae"); // Æ
strReplace(s, "\xDF", "ss"); // ß
strReplace(s, "\xE6", "ae"); // æ
strReplace(s, "\xE4", "ae"); // ä
strReplace(s, "\xF6", "oe"); // ö
strReplace(s, "\xFC", "ue"); // ü
strReplace(s, "\xC4", "Ae"); // ƒ
strReplace(s, "\xD6", "Oe"); // ÷
strReplace(s, "\xDC", "Ue"); //
strReplace(s, "\xC6", "Ae"); //
strReplace(s, "\xDF", "ss"); //
strReplace(s, "\xE6", "ae"); // Ê
strReplace(s, "\xE4", "ae"); //
strReplace(s, "\xF6", "oe"); // ˆ
strReplace(s, "\xFC", "ue"); // ¸
#else
strReplace(s, "\xa7", "ss");
strReplace(s, "\x80", "Ae");
Expand All @@ -270,56 +270,56 @@ string strToAscii(string& s)
#ifdef _WIN32
ascii_conv('\xbf', '?') // ?
ascii_conv('\xa1', '!') // !
ascii_conv('\xC0', 'A') // À
ascii_conv('\xC1', 'A') // Á
ascii_conv('\xC2', 'A') // Â
ascii_conv('\xC3', 'A') // Ã
ascii_conv('\xC5', 'A') // Å
ascii_conv('\xC7', 'C') // Ç
ascii_conv('\xC8', 'E') // È
ascii_conv('\xC9', 'E') // É
ascii_conv('\xCA', 'E') // Ê
ascii_conv('\xCB', 'E') // Ë
ascii_conv('\xCC', 'I') // Ì
ascii_conv('\xCD', 'I') // Í
ascii_conv('\xCE', 'I') // Î
ascii_conv('\xCF', 'I') // Ï
ascii_conv('\xD0', 'D') // Ð
ascii_conv('\xD1', 'N') // Ñ
ascii_conv('\xD2', 'O') // Ò
ascii_conv('\xD3', 'O') // Ó
ascii_conv('\xD4', 'O') // Ô
ascii_conv('\xD5', 'O') // Õ
ascii_conv('\xC0', 'A') //
ascii_conv('\xC1', 'A') //
ascii_conv('\xC2', 'A') //
ascii_conv('\xC3', 'A') //
ascii_conv('\xC5', 'A') //
ascii_conv('\xC7', 'C') //
ascii_conv('\xC8', 'E') //
ascii_conv('\xC9', 'E') //
ascii_conv('\xCA', 'E') //
ascii_conv('\xCB', 'E') //
ascii_conv('\xCC', 'I') //
ascii_conv('\xCD', 'I') //
ascii_conv('\xCE', 'I') //
ascii_conv('\xCF', 'I') //
ascii_conv('\xD0', 'D') //
ascii_conv('\xD1', 'N') //
ascii_conv('\xD2', 'O') //
ascii_conv('\xD3', 'O') //
ascii_conv('\xD4', 'O') //
ascii_conv('\xD5', 'O') //
ascii_conv('\xD8', 'O') // O
ascii_conv('\xD9', 'U') // Ù
ascii_conv('\xDA', 'U') // Ú
ascii_conv('\xDB', 'U') // Û
ascii_conv('\xDD', 'Y') // Ý
ascii_conv('\xE0', 'a') // à
ascii_conv('\xE1', 'a') // á
ascii_conv('\xE2', 'a') // â
ascii_conv('\xE3', 'a') // ã
ascii_conv('\xE5', 'a') // å
ascii_conv('\xE7', 'c') // ç
ascii_conv('\xE8', 'e') // è
ascii_conv('\xE9', 'e') // é
ascii_conv('\xEA', 'e') // ê
ascii_conv('\xEB', 'e') // ë
ascii_conv('\xEC', 'i') // ì
ascii_conv('\xED', 'i') // í
ascii_conv('\xEE', 'i') // î
ascii_conv('\xEF', 'i') // ï
ascii_conv('\xF1', 'n') // ñ
ascii_conv('\xF2', 'o') // ò
ascii_conv('\xF3', 'o') // ó
ascii_conv('\xF4', 'o') // ô
ascii_conv('\xF5', 'o') // õ
ascii_conv('\xF8', 'o') // ø
ascii_conv('\xF9', 'u') // ù
ascii_conv('\xFA', 'u') // ú
ascii_conv('\xFB', 'u') // û
ascii_conv('\xFD', 'y') // ý
ascii_conv('\xFF', 'y') // ÿ
ascii_conv('\xD9', 'U') // Ÿ
ascii_conv('\xDA', 'U') //
ascii_conv('\xDB', 'U') //
ascii_conv('\xDD', 'Y') //
ascii_conv('\xE0', 'a') //
ascii_conv('\xE1', 'a') // ·
ascii_conv('\xE2', 'a') //
ascii_conv('\xE3', 'a') //
ascii_conv('\xE5', 'a') // Â
ascii_conv('\xE7', 'c') // Á
ascii_conv('\xE8', 'e') // Ë
ascii_conv('\xE9', 'e') // È
ascii_conv('\xEA', 'e') // Í
ascii_conv('\xEB', 'e') // Î
ascii_conv('\xEC', 'i') // Ï
ascii_conv('\xED', 'i') // Ì
ascii_conv('\xEE', 'i') // Ó
ascii_conv('\xEF', 'i') // Ô
ascii_conv('\xF1', 'n') // Ò
ascii_conv('\xF2', 'o') // Ú
ascii_conv('\xF3', 'o') // Û
ascii_conv('\xF4', 'o') // Ù
ascii_conv('\xF5', 'o') // ı
ascii_conv('\xF8', 'o') // ¯
ascii_conv('\xF9', 'u') // ˘
ascii_conv('\xFA', 'u') // ˙
ascii_conv('\xFB', 'u') // ˚
ascii_conv('\xFD', 'y') // ˝
ascii_conv('\xFF', 'y') // ˇ
#else
ascii_conv('\x81', 'A')
ascii_conv('\x82', 'C')
Expand Down Expand Up @@ -390,6 +390,8 @@ string strRemoveXmlTags(const string& s, bool replaceEntities)
}
if (replaceEntities) {
strReplace(r, "&", "&");
strReplace(r, " ", " ");
strReplace(r, "♥", "");
strReplace(r, "\\251", "(C)");
strReplace(r, "à", "a"); // agrave
strReplace(r, "á", "a"); // aacute
Expand Down

0 comments on commit 8975d1a

Please sign in to comment.