+#else // wxUSE_UNICODE_UTF8
+
+size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const
+{
+ if ( format == wxDF_UNICODETEXT || wxLocaleIsUtf8 )
+ {
+ return m_text.utf8_length();
+ }
+ else // wxDF_TEXT
+ {
+ const wxCharBuffer buf(wxConvLocal.cWC2MB(m_text.wc_str()));
+ return buf ? strlen(buf) : 0;
+ }
+}
+
+bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const
+{
+ if ( !buf )
+ return false;
+
+ if ( format == wxDF_UNICODETEXT || wxLocaleIsUtf8 )
+ {
+ memcpy(buf, m_text.utf8_str(), m_text.utf8_length());
+ }
+ else // wxDF_TEXT
+ {
+ const wxCharBuffer bufLocal(wxConvLocal.cWC2MB(m_text.wc_str()));
+ if ( !bufLocal )
+ return false;
+
+ memcpy(buf, bufLocal, strlen(bufLocal));
+ }
+
+ return true;
+}
+
+bool wxTextDataObject::SetData(const wxDataFormat& format,
+ size_t len, const void *buf_)
+{
+ const char * const buf = static_cast<const char *>(buf_);
+
+ if ( buf == NULL )
+ return false;
+
+ if ( format == wxDF_UNICODETEXT || wxLocaleIsUtf8 )
+ {
+ // normally the data is in UTF-8 so we could use FromUTF8Unchecked()
+ // but it's not absolutely clear what GTK+ does if the clipboard data
+ // is not in UTF-8 so do an extra check for tranquility, it shouldn't
+ // matter much if we lose a bit of performance when pasting from
+ // clipboard
+ m_text = wxString::FromUTF8(buf, len);
+ }
+ else // wxDF_TEXT, convert from current (non-UTF8) locale
+ {
+ m_text = wxConvLocal.cMB2WC(buf, len, NULL);
+ }
+
+ return true;
+}
+
+#endif // wxUSE_UNICODE_WCHAR/wxUSE_UNICODE_UTF8
+
+#elif defined(wxNEEDS_UTF16_FOR_TEXT_DATAOBJ)