mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 02:02:24 +00:00
Bug fixes
Fix support for exporting SSD-Android compatible SSD subscriptions. Fix format error in exporting SIP002 subscriptions.
This commit is contained in:
3 files changed
+36
-5
No files matched your search
@@ -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();
|
||||
}
|
||||
Reference in new issue
Block a user