From de6fbaaec46412d3fdef0c01810182c0b01cafbd Mon Sep 17 00:00:00 2001 From: Carolyn MacLeod Date: Tue, 24 Jul 2012 15:32:30 -0400 Subject: Bug 384381 - HTMLTransfer uses UTF-16 to copy to clipboard (should use UTF-8 to be compatible with paste) --- .../gtk/org/eclipse/swt/dnd/HTMLTransfer.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/HTMLTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/HTMLTransfer.java index d91873d56c..cd7465f614 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/HTMLTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/HTMLTransfer.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.swt.dnd; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; /** @@ -61,13 +62,11 @@ public void javaToNative (Object object, TransferData transferData){ DND.error(DND.ERROR_INVALID_DATA); } String string = (String)object; - int charCount = string.length(); - char [] chars = new char[charCount +1]; - string.getChars(0, charCount , chars, 0); - int byteCount = chars.length*2; + byte[] utf8 = Converter.wcsToMbcs(null, string, true); + int byteCount = utf8.length; int /*long*/ pValue = OS.g_malloc(byteCount); if (pValue == 0) return; - OS.memmove(pValue, chars, byteCount); + OS.memmove(pValue, utf8, byteCount); transferData.length = byteCount; transferData.format = 8; transferData.pValue = pValue; -- cgit