+ // Now store the contents range
+ bookr->SetContentsRange(cont_start, m_contents.size());
+
+#if wxUSE_WCHAR_T
+ // MS HTML Help files [written by MS HTML Help Workshop] are broken
+ // in that the data are iso-8859-1 (including HTML entities), but must
+ // be interpreted as being in language's windows charset. Correct the
+ // differences here and also convert to wxConvLocal in ANSI build
+ if (encoding != wxFONTENCODING_SYSTEM)
+ {
+ #if wxUSE_UNICODE
+ #define CORRECT_STR(str, conv) \
+ str = wxString((str).mb_str(wxConvISO8859_1), conv)
+ #else
+ #define CORRECT_STR(str, conv) \
+ str = wxString((str).wc_str(conv), wxConvLocal)
+ #endif
+ wxCSConv conv(encoding);
+ size_t IndexCnt = m_index.size();
+ size_t ContentsCnt = m_contents.size();
+ size_t i;
+ for (i = IndexOld; i < IndexCnt; i++)
+ {
+ CORRECT_STR(m_index[i].name, conv);
+ }
+ for (i = ContentsOld; i < ContentsCnt; i++)
+ {
+ CORRECT_STR(m_contents[i].name, conv);
+ }
+ #undef CORRECT_STR
+ }
+#else
+ wxUnusedVar(IndexOld);
+ wxUnusedVar(ContentsOld);
+ wxASSERT_MSG(encoding == wxFONTENCODING_SYSTEM, wxT("Help files need charset conversion, but wxUSE_WCHAR_T is 0"));
+#endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T
+
+ m_bookRecords.Add(bookr);
+ if (!m_index.empty())
+ {
+ m_index.Sort(wxHtmlHelpIndexCompareFunc);
+ }