diff --git a/include/wx/osx/core/cfstring.h b/include/wx/osx/core/cfstring.h index 8b939a29a6..fad01b88d4 100644 --- a/include/wx/osx/core/cfstring.h +++ b/include/wx/osx/core/cfstring.h @@ -30,6 +30,7 @@ WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( wxString *data ) ; WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( wxString *data ) ; WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data ) ; +WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data, size_t len ) ; WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( char * data ) ; WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ; diff --git a/src/osx/carbon/dataobj.cpp b/src/osx/carbon/dataobj.cpp index edd62110b3..f6967ddbba 100644 --- a/src/osx/carbon/dataobj.cpp +++ b/src/osx/carbon/dataobj.cpp @@ -487,8 +487,10 @@ bool wxDataObject::GetFromPasteboard( void * pb ) memset( buf, 0, flavorDataSize + 4 ); memcpy( buf, CFDataGetBytePtr( flavorData ), flavorDataSize ); - if (dataFormat.GetType() == wxDF_TEXT) - wxMacConvertNewlines10To13( (char*) buf ); + if (dataFormat.GetType() == wxDF_TEXT || dataFormat.GetType() == wxDF_UNICODETEXT) + { + wxMacConvertNewlines13To10( (char*) buf, flavorDataSize ); + } SetData( flavorFormat, flavorDataSize, buf ); transferred = true; free( buf ); diff --git a/src/osx/core/cfstring.cpp b/src/osx/core/cfstring.cpp index 82b5808aa3..f44be612aa 100644 --- a/src/osx/core/cfstring.cpp +++ b/src/osx/core/cfstring.cpp @@ -34,6 +34,15 @@ void wxMacConvertNewlines13To10( char * data ) } } +void wxMacConvertNewlines13To10( char * data, size_t len ) +{ + for ( ; len; ++data, --len ) + { + if ( *data == 0x0d ) + *data = 0x0a; + } +} + void wxMacConvertNewlines10To13( char * data ) { char * buf = data ;