#if wxUSE_UNICODE
wxString stc2wx(const char* str, size_t len)
{
+ // note: we assume that str is of length len not including the terminating null.
+
+ if (!len)
+ return wxEmptyString;
+ else if (str[len-1] == 0)
+ // It's already terminated correctly.
+ return wxString(str, wxConvUTF8, len);
+
char *buffer=new char[len+1];
strncpy(buffer, str, len);
buffer[len]=0;