wxString CFileDataIO::ReadOnlyString(bool bOptUTF8, uint16 raw_len) const { // We only need to set the the NULL terminator, since we know that // reads will either succeed or throw an exception, in which case // we wont be returning anything std::vector<char> val_array(raw_len + 1); val_array[raw_len] = 0; char* val = &(val_array[0]); Read(val, raw_len); wxString str; if (CHECK_BOM(raw_len, val)) { // This is a UTF8 string with a BOM header, skip header. str = UTF82unicode(val + 3); } else if (bOptUTF8) { str = UTF82unicode(val); if (str.IsEmpty()) { // Fallback to Latin-1 str = wxString(val, wxConvISO8859_1, raw_len); } } else { // Raw strings are written as Latin-1 (see CFileDataIO::WriteStringCore) str = wxString(val, wxConvISO8859_1, raw_len); } return str; }
wxString CECTag::GetStringData() const { return UTF82unicode(GetStringDataSTL().c_str()); }