You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
some examples of what happens:
79 => 79
80 => C2 80 (this seems to be the lowest affected)
96 => C2 96
A7 => C2 A7
9E => C2 9E
B2 => C2 B2
88 => C2 88
FD => C3 BD
FB => C3 BB
FF => C3 BF
E0 => C3 A0
D0 => C3 90
C0 => C3 80
BF => C2 BF (here seems to be the limit for the character being edited)
I print the characters in the command prompt and they're fine, but when looking in InsideClipboard, I see there's a difference
here's an example of my data i'm having issues with: (left is what I'm trying to achieve, right is when I put the hex values in the clipboard via klembord)
edit: so I think this is because the dict I have to put the string of hex characters in doesn't support the characters starting from 80, so it is only a 7 bit string while I need an 8 bit one
The text was updated successfully, but these errors were encountered:
solution for my usecase:
i copied from the source the part that actually puts the data in the clipboard and used the encoding "charmap"
content = {'ladderSnippetXML': data}
print(data)
target = 'ladderSnippetXML'
formats = OrderedDict()
for target, data in content.items():
if not isinstance(data, (str, ByteString, type(None))):
raise TypeError('Unsupported data type:\n{}'.format(repr(data)))
elif data:
if target in TARGETS:
if isinstance(data, str):
formats[TARGETS[target]] = data.encode()
else:
formats[TARGETS[target]] = data
print("istarget")
else:
format = windll.user32.RegisterClipboardFormatW(
create_unicode_buffer(target, 1024))
if isinstance(data, str):
formats[format] = data.encode("charmap")
else:
formats[format] = data
if windll.user32.OpenClipboard(None):
windll.user32.EmptyClipboard()
for format, data in formats.items():
handle = windll.kernel32.GlobalAlloc(
GMEM_MOVEABLE | GMEM_ZEROINIT, len(data) + 2)
ptr = windll.kernel32.GlobalLock(handle)
memmove(ptr, data, len(data))
windll.kernel32.GlobalUnlock(ptr)
windll.user32.SetClipboardData(format, handle)
windll.user32.CloseClipboard()
else:
raise RuntimeError('Failed to open clipboard')
some examples of what happens:
79 => 79
80 => C2 80 (this seems to be the lowest affected)
96 => C2 96
A7 => C2 A7
9E => C2 9E
B2 => C2 B2
88 => C2 88
FD => C3 BD
FB => C3 BB
FF => C3 BF
E0 => C3 A0
D0 => C3 90
C0 => C3 80
BF => C2 BF (here seems to be the limit for the character being edited)
I print the characters in the command prompt and they're fine, but when looking in InsideClipboard, I see there's a difference
here's an example of my data i'm having issues with: (left is what I'm trying to achieve, right is when I put the hex values in the clipboard via klembord)

edit: so I think this is because the dict I have to put the string of hex characters in doesn't support the characters starting from 80, so it is only a 7 bit string while I need an 8 bit one
The text was updated successfully, but these errors were encountered: