When writing an UTF-8 memory subtitle file, also include a BOM to keep VSFilter happy.

Originally committed to SVN as r5789.
This commit is contained in:
Niels Martin Hansen 2011-10-27 23:00:56 +00:00
parent e2d75337db
commit a039499909
1 changed files with 6 additions and 1 deletions

View File

@ -201,12 +201,17 @@ void AssFile::SaveMemory(std::vector<char> &dst,const wxString encoding) {
dst.clear(); dst.clear();
dst.reserve(0x4000); dst.reserve(0x4000);
// Write file
entryIter cur; entryIter cur;
unsigned int lineSize = 0; unsigned int lineSize = 0;
unsigned int targetSize = 0; unsigned int targetSize = 0;
unsigned int pos = 0; unsigned int pos = 0;
wxCharBuffer buffer; wxCharBuffer buffer;
// Put a BOM
dst.resize(3);
dst[0] = '\xef'; dst[1] = '\xbb'; dst[2] = '\xbf';
pos += 3;
// Write the rest
for (cur=Line.begin();cur!=Line.end();cur++) { for (cur=Line.begin();cur!=Line.end();cur++) {
// Convert // Convert
wxString temp = (*cur)->GetEntryData() + _T("\r\n"); wxString temp = (*cur)->GetEntryData() + _T("\r\n");