Bug fixes

Fix support for exporting SSD-Android compatible SSD subscriptions.
Fix format error in exporting SIP002 subscriptions.
This commit is contained in:
Tindy X committed 2019-12-31 15:46:28 +08:00
1 parent c38c1b4cf5
commit 3b4ad47dae
3 files changed
+36 -5

No files matched your search

+30
View File
@@ -935,3 +935,33 @@ std::string getFormData(const std::string &raw_data)
}
return file;
}
std::string UTF8ToCodePoint(std::string data)
{
std::stringstream ss;
int charcode = 0;
for(std::string::size_type i = 0; i < data.size(); i++)
{
charcode = data[i] & 0xff;
if((charcode >> 7) == 0)
{
ss<<data[i];
}
else if((charcode >> 5) == 6)
{
ss<<"\\u"<<std::hex<<((data[i + 1] & 0x3f) | (data[i] & 0x1f) << 6);
i++;
}
else if((charcode >> 4) == 14)
{
ss<<"\\u"<<std::hex<<((data[i + 2] & 0x3f) | (data[i + 1] & 0x3f) << 6 | (data[i] & 0xf) << 12);
i += 2;
}
else if((charcode >> 3) == 30)
{
ss<<"\\u"<<std::hex<<((data[i + 3] & 0x3f) | (data[i + 2] & 0x3f) << 6 | (data[i + 1] & 0x3f) << 12 | (data[i] & 0x7) << 18);
i += 3;
}
}
return ss.str();
}