+#if wxUSE_UNICODE
+ delete m_conv;
+#endif // wxUSE_UNICODE
+}
+
+void wxTextInputStream::UngetLast()
+{
+ size_t byteCount = 0;
+ while(m_lastBytes[byteCount]) // pseudo ANSI strlen (even for Unicode!)
+ byteCount++;
+ m_input.Ungetch(m_lastBytes, byteCount);
+ memset((void*)m_lastBytes, 0, 10);
+}
+
+wxChar wxTextInputStream::NextChar()
+{
+#if wxUSE_UNICODE
+ wxChar wbuf[2];
+ memset((void*)m_lastBytes, 0, 10);
+ for(size_t inlen = 0; inlen < 9; inlen++)
+ {
+ // actually read the next character
+ m_lastBytes[inlen] = m_input.GetC();
+
+ if(m_input.LastRead() <= 0)
+ return wxEOT;
+
+ if ( m_conv->ToWChar(wbuf, WXSIZEOF(wbuf), m_lastBytes, inlen + 1)
+ != wxCONV_FAILED )
+ return wbuf[0];
+ }
+ // there should be no encoding which requires more than nine bytes for one character...
+ return wxEOT;
+#else
+ m_lastBytes[0] = m_input.GetC();
+
+ if(m_input.LastRead() <= 0)
+ return wxEOT;
+
+ return m_lastBytes[0];
+#endif
+