fixed conversion from Unicode in StreamOut() once again
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -822,13 +822,13 @@ wxTextCtrl::StreamOut(wxFontEncoding encoding, bool selectionOnly) const
|
|||||||
// decreased by wxRichEditStreamOut
|
// decreased by wxRichEditStreamOut
|
||||||
*(wchBuf.data() + data.len) = L'\0';
|
*(wchBuf.data() + data.len) = L'\0';
|
||||||
|
|
||||||
// now convert to the given encoding (this is a lossful conversion but
|
// now convert to the given encoding (this is a possibly lossful
|
||||||
// what else can we do)
|
// conversion but what else can we do)
|
||||||
wxCSConv conv(encoding);
|
wxCSConv conv(encoding);
|
||||||
size_t lenNeeded = conv.WC2MB(NULL, wchBuf, len);
|
size_t lenNeeded = conv.WC2MB(NULL, wchBuf, 0);
|
||||||
if ( lenNeeded )
|
if ( lenNeeded++ )
|
||||||
{
|
{
|
||||||
conv.WC2MB(wxStringBuffer(out, lenNeeded), wchBuf, len);
|
conv.WC2MB(wxStringBuffer(out, lenNeeded), wchBuf, lenNeeded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user