+#if wxUSE_UNICODE // otherwise wxChar === char
+
+void wxEncodingConverter::Convert(const char* input, wxChar* output)
+{
+ wxASSERT_MSG(!m_UnicodeInput, wxT("You cannot convert from unicode if input is const char*!"));
+
+ const char *i;
+ wxChar *o;
+
+ if (m_JustCopy)
+ {
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (wxChar)(*(i++));
+ *o = 0;
+ return;
+ }
+
+ wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (wxChar)(m_Table[(wxUint8)*(i++)]);
+ *o = 0;
+}
+
+
+
+void wxEncodingConverter::Convert(const wxChar* input, char* output)
+{
+ wxASSERT_MSG(!m_UnicodeOutput, wxT("You cannot convert to unicode if output is const char*!"));
+
+ const wxChar *i;
+ char *o;
+
+ if (m_JustCopy)
+ {
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (char)(*(i++));
+ *o = 0;
+ return;
+ }
+
+ wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+
+ if (m_UnicodeInput)
+ for (i = input, o = output; *i != 0; i++, o++)
+ *o = (char)(m_Table[(wxUint16)*i]);
+ else
+ for (i = input, o = output; *i != 0; i++, o++)
+ *o = (char)(m_Table[(wxUint8)*i]);
+ *o = 0;
+}
+
+
+
+void wxEncodingConverter::Convert(const char* input, char* output)
+{
+ wxASSERT_MSG(!m_UnicodeOutput, wxT("You cannot convert to unicode if output is const char*!"));
+ wxASSERT_MSG(!m_UnicodeInput, wxT("You cannot convert from unicode if input is const char*!"));
+
+ const char *i;
+ char *o;
+
+ if (m_JustCopy)
+ {
+ strcpy(output, input);
+ return;
+ }
+
+ wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (char)(m_Table[(wxUint8)*(i++)]);
+ *o = 0;
+}
+
+#endif // wxUSE_UNICODE
+