diff options
author | George Hazan <ghazan@miranda.im> | 2018-02-23 15:56:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-02-23 15:56:06 +0300 |
commit | c086c2ec984431fad9575fedb6e681458e99e524 (patch) | |
tree | 0b5746b1337b3b1115009fb455935f1feb02bb0b | |
parent | 81c6cfa003de2bd8883c93eecd2c1e571b782eb2 (diff) |
SmileyAdd: fix for broken UTF16 constants
-rw-r--r-- | plugins/SmileyAdd/src/smileys.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 56fb2ddf14..8d6e69845f 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -842,6 +842,8 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) static const CMStringW testString(L"Test String");
+static MRegexp16 isCode(L"\\&\\#(\\d*)\\;");
+
SmileyLookup::SmileyLookup(const CMStringW &str, const bool regexs, const int ind, const CMStringW &smpt)
{
m_ind = ind;
@@ -855,7 +857,19 @@ SmileyLookup::SmileyLookup(const CMStringW &str, const bool regexs, const int in }
}
else {
- m_text = str;
+ if (isCode.match(str) >= 0) {
+ uint32_t iCode = _wtoi(isCode.getGroup(1));
+ wchar_t tmp[3] = { 0, 0, 0 };
+ if (iCode < 0x10000)
+ tmp[0] = LOWORD(iCode), tmp[1] = HIWORD(iCode);
+ else {
+ iCode -= 0x10000;
+ tmp[0] = 0xD800 + (iCode >> 10);
+ tmp[1] = 0xDC00 + (iCode & 0x3FF);
+ }
+ m_text = tmp;
+ }
+ else m_text = str;
m_valid = !str.IsEmpty();
}
}
|