I'm trying to make a program to repair corrupted subtitle .srt files. After doing some research, I figured out some websites which repair files with this issue are converting it to UTF-8, like subtitletools.com.
I used the method I found in this link: Storing UTF-8 string in a UnicodeString to convert the text I loaded from my .srt file. Many pages suggest this way for converting. But I didn't succeed at last. What am I doing wrong?
This is my code for converting:
procedure Tfrm_main.btn_convertClick(Sender: TObject); var UnicodeStr: UnicodeString; UTF8Str: RawByteString; begin UTF8Str := UTF8Encode(memo_source.Text); SetCodePage(UTF8Str, 0, False); UnicodeStr := UTF8Str; memo_result.Text := UnicodeStr; end; The program works (the result is weird yet, but had a little difference):
Here is a screenshot of my program trying to convert a .srt file to UTF-8:
Related questions 5 Reading unicode characters from text file in Delphi 2009 3 Reading srt (subtitle) files with Python3 1 Replacing a unicode character in UTF-8 file using delphi 2010 Related questions 5 Reading unicode characters from text file in Delphi 2009 3 Reading srt (subtitle) files with Python3 1 Replacing a unicode character in UTF-8 file using delphi 2010 3 How to auto detect the encoding of srt subtitle file 0 Convert text from UTF-8 to Windows 1251 0 Making Batch file code with VBScript to work with Unicode symbols 1 Why utf-8 character in subtitle are in different from ffmpeg 1 FFMPEG UTF-8 subtitles not properly displayed in mp4 file 0 Detecting the encoding of srt file and changing it 1 Convert Windows-1252 subtitle file to utf-8 Load 7 more related questions Show fewer related questions
Reset to default