]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed FromUTF8 in ANSI builds
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 5 May 2007 19:19:48 +0000 (19:19 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 5 May 2007 19:19:48 +0000 (19:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45846 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/string.h

index 6a47d751a09d423ca50dbe2ccd57fa291b8637fa..3890dd07d1e343d0a574b2a77d8017d17c9edbae 100644 (file)
@@ -1154,7 +1154,11 @@ public:
     static wxString FromUTF8(const char *utf8)
       { return wxString(wxConvUTF8.cMB2WC(utf8)); }
     static wxString FromUTF8(const char *utf8, size_t len)
-      { return wxString(wxConvUTF8.cMB2WC(utf8, len == npos ? wxNO_LEN : len)); }
+    {
+      size_t wlen;
+      wxWCharBuffer buf(wxConvUTF8.cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen));
+      return wxString(buf.data(), wlen);
+    }
     const wxCharBuffer utf8_str() const { return wxConvUTF8.cWC2MB(wc_str()); }
     const wxCharBuffer ToUTF8() const { return utf8_str(); }
 #endif