bool EncodingDetector::DetectUTF16(const QByteArray& text)
{
    if (IsTextUTF16BE(text))
    {
        m_Encoding = QTextCodec::codecForName("UTF-16BE");
        return true;
    }
    else if (IsTextUTF16LE(text))
    {
        m_Encoding = QTextCodec::codecForName("UTF-16LE");
        return true;
    }
    return false;
}
Esempio n. 2
0
bool EncodingDetector::DetectUTF16(const wxByte *byt, size_t size)
{
    if (IsTextUTF16BE(byt, size))
    {
        m_Encoding = wxFONTENCODING_UTF16BE;
        return true;
    }
    else if (IsTextUTF16LE(byt, size))
    {
        m_Encoding = wxFONTENCODING_UTF16LE;
        return true;
    }
    return false;
}