Cope with the common case of utf-8 being specified in the .hhp file, and convert the book title.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -685,6 +685,19 @@ bool wxHtmlHelpData::AddBook(const wxString& book)
|
|||||||
enc = wxFontMapper::Get()->CharsetToEncoding(charset);
|
enc = wxFontMapper::Get()->CharsetToEncoding(charset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// No conversion was done on the title yet; at least
|
||||||
|
// test for a common case.
|
||||||
|
if (charset == wxT("utf-8") && !title.IsEmpty())
|
||||||
|
{
|
||||||
|
char *buf = new char[title.Length()+1];
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < title.Length(); i++)
|
||||||
|
buf[i] = (char) title[i];
|
||||||
|
buf[i] = 0;
|
||||||
|
title = wxString::FromUTF8(buf);
|
||||||
|
delete[] buf;
|
||||||
|
}
|
||||||
|
|
||||||
bool rtval = AddBookParam(*fi, enc,
|
bool rtval = AddBookParam(*fi, enc,
|
||||||
title, contents, index, start, fsys.GetPath());
|
title, contents, index, start, fsys.GetPath());
|
||||||
delete fi;
|
delete fi;
|
||||||
|
Reference in New Issue
Block a user