#include "wx/intl.h"
 #endif //WX_PRECOMP
 
-// FreeBSD requires this, it probably doesn't hurt for others
-#ifdef __UNIX__
+// FreeBSD & Watcom require this, it probably doesn't hurt for others
+#if defined(__UNIX__) || defined(__WATCOMC__)
     #include <sys/types.h>
 #endif
 
     {
         len++;
 
+#if wxUSE_UNICODE
+        wxCharBuffer buf(len);
+
+        (void)regerror(errorcode, &m_RegEx, (char *)buf.data(), len);
+
+        msg = wxString(buf.data(), wxConvLibc);
+#else // !Unicode
         (void)regerror(errorcode, &m_RegEx, msg.GetWriteBuf(len), len);
 
         msg.UngetWriteBuf();
+#endif // Unicode/!Unicode
     }
     else // regerror() returned 0
     {
         flagsRE |= REG_NEWLINE;
 
     // compile it
-    int errorcode = regcomp(&m_RegEx, expr, flagsRE);
+    int errorcode = regcomp(&m_RegEx, expr.mb_str(), flagsRE);
     if ( errorcode )
     {
         wxLogError(_("Invalid regular expression '%s': %s"),
     }
 
     // do match it
-    int rc = regexec(&self->m_RegEx, str, m_nMatches, m_Matches, flagsRE);
+    int rc = regexec(&self->m_RegEx, wxConvertWX2MB(str), m_nMatches, m_Matches, flagsRE);
 
     switch ( rc )
     {