Encoding fix for non english languages

This commit is contained in:
Artur Alekseev 2024-09-24 23:23:46 +03:00
parent 31cb3a67cb
commit cc5ed55988

View File

@ -132,6 +132,8 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Tesseract
Tesseract5.SetImage(bitmap);
result = Tesseract5.GetHOCR();
result = ParseHocr(result);
byte[] bytes = Encoding.Default.GetBytes(result);
result = Encoding.UTF8.GetString(bytes);
Marshal.FreeHGlobal(Tesseract5.imageData); //free temp image global buffer (used to pass image data to external c++ dll)
Tesseract5.imageData = IntPtr.Zero; //remove handle so we don't try to free it again
}