added FromUTF8Unchecked() for ANSI build too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54737 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1328,9 +1328,20 @@ public:
|
|||||||
{ return wxString(wxMBConvUTF8().cMB2WC(utf8)); }
|
{ return wxString(wxMBConvUTF8().cMB2WC(utf8)); }
|
||||||
static wxString FromUTF8(const char *utf8, size_t len)
|
static wxString FromUTF8(const char *utf8, size_t len)
|
||||||
{
|
{
|
||||||
size_t wlen;
|
size_t wlen;
|
||||||
wxWCharBuffer buf(wxMBConvUTF8().cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen));
|
wxWCharBuffer buf(wxMBConvUTF8().cMB2WC(utf8, len == npos ? wxNO_LEN : len, &wlen));
|
||||||
return wxString(buf.data(), wlen);
|
return wxString(buf.data(), wlen);
|
||||||
|
}
|
||||||
|
static wxString FromUTF8Unchecked(const char *utf8, size_t len = npos)
|
||||||
|
{
|
||||||
|
size_t wlen;
|
||||||
|
wxWCharBuffer buf(wxMBConvUTF8().cMB2WC(utf8,
|
||||||
|
len == npos ? wxNO_LEN : len,
|
||||||
|
&wlen));
|
||||||
|
wxASSERT_MSG( !utf8 || !*utf8 || wlen,
|
||||||
|
"string must be valid UTF-8" );
|
||||||
|
|
||||||
|
return wxString(buf.data(), wlen);
|
||||||
}
|
}
|
||||||
const wxCharBuffer utf8_str() const
|
const wxCharBuffer utf8_str() const
|
||||||
{ return wxMBConvUTF8().cWC2MB(wc_str()); }
|
{ return wxMBConvUTF8().cWC2MB(wc_str()); }
|
||||||
|
Reference in New Issue
Block a user