This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Cees.Timmerman
Recipients Cees.Timmerman, ezio.melotti, vstinner
Date 2014-12-05.09:58:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1417773485.83.0.226794721808.issue22999@psf.upfronthosting.co.za>
In-reply-to
Content
# http://stackoverflow.com/a/25678113/819417
def copy(data):
    if not isinstance(data, unicode):
        data = data.decode('mbcs')
    OpenClipboard(None)
    EmptyClipboard()
    hCd = GlobalAlloc(GMEM_DDESHARE, 2 * (len(data) + 1))
    pchData = GlobalLock(hCd)
    wcscpy(ctypes.c_wchar_p(pchData), data)
    GlobalUnlock(hCd)
    SetClipboardData(CF_UNICODETEXT, hCd)
    CloseClipboard()

Emoji "📋" (\U0001f400) is copied as "🐀" (\U0001f4cb), or "📋." turns to "📋" (note the period).

It works fine in Python 3.2.5.
History
Date User Action Args
2014-12-05 09:58:05Cees.Timmermansetrecipients: + Cees.Timmerman, vstinner, ezio.melotti
2014-12-05 09:58:05Cees.Timmermansetmessageid: <1417773485.83.0.226794721808.issue22999@psf.upfronthosting.co.za>
2014-12-05 09:58:05Cees.Timmermanlinkissue22999 messages
2014-12-05 09:58:05Cees.Timmermancreate