When I open a legacy database in Sqlite Browser, the text is already displayed wrong. The only encoding I can set is UTF-8 and UTF-16.
When I query the database, the encoding is already wrong in Visual Studio.
I assume the text is encoded in ANSI (Windows-1252). I tried converting it to UTF-8
var encoding = Encoding.GetEncoding(1252);
byte[] encBytes = encoding.GetBytes(result);
byte[] utf8Bytes = Encoding.Convert(encoding, Encoding.UTF8, encBytes);
return Encoding.UTF8.GetString(utf8Bytes);
but now the question mark symbol is just a question mark.
Somehow, the external legacy app displays it correctly, so there appears to be a way. But I'm not sure what I can try next.
Aucun commentaire:
Enregistrer un commentaire