-        fsys.ChangePathTo(bookFull);
-        s = fi->GetStream();
-        sz = s->GetSize();
-        buff = new char[sz + 1];
-        buff[sz] = 0;
-        s->Read(buff, sz);
-        lineptr = buff;
-
-        do {
-            lineptr = ReadLine(lineptr, linebuf);
-
-            if (strstr(linebuf, "Title=") == linebuf)
-                title = linebuf + strlen("Title=");
-            if (strstr(linebuf, "Default topic=") == linebuf)
-                start = linebuf + strlen("Default topic=");
-            if (strstr(linebuf, "Index file=") == linebuf)
-                index = linebuf + strlen("Index file=");
-            if (strstr(linebuf, "Contents file=") == linebuf)
-                contents = linebuf + strlen("Contents file=");
-            if (strstr(linebuf, "Charset=") == linebuf)
-                charset = linebuf + strlen("Charset=");
+        fsys.ChangePathTo(book);
+
+        const wxChar *lineptr;
+        wxChar linebuf[300];
+        wxString tmp;
+        wxHtmlFilterPlainText filter;
+        tmp = filter.ReadFile(*fi);
+        lineptr = tmp.c_str();
+
+        do 
+        {
+            lineptr = ReadLine(lineptr, linebuf, 300);
+            
+            for (wxChar *ch = linebuf; *ch != wxT('\0') && *ch != wxT('='); ch++)
+               *ch = tolower(*ch);
+
+            if (wxStrstr(linebuf, _T("title=")) == linebuf)
+                title = linebuf + wxStrlen(_T("title="));
+            if (wxStrstr(linebuf, _T("default topic=")) == linebuf)
+                start = linebuf + wxStrlen(_T("default topic="));
+            if (wxStrstr(linebuf, _T("index file=")) == linebuf)
+                index = linebuf + wxStrlen(_T("index file="));
+            if (wxStrstr(linebuf, _T("contents file=")) == linebuf)
+                contents = linebuf + wxStrlen(_T("contents file="));
+            if (wxStrstr(linebuf, _T("charset=")) == linebuf)
+                charset = linebuf + wxStrlen(_T("charset="));