GNU bug report logs -
#31149
27.0.50; (gui-get-selection nil 'text/html) returns mis-decoded text
Previous Next
Reported by: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Date: Fri, 13 Apr 2018 20:56:02 UTC
Severity: normal
Found in version 27.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #26 received at 31149 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:
> (gui-get-selection nil 'text/html)
>
> returns utf-16 text when the primary selection is owned by Mozilla, but
> we decode it as latin-1 instead, so it looks like garbage.
This is still the case on the trunk:
#("ÿþM^@e^@r^@g^@e^@d^@" 0 14 (foreign-selection STRING charset iso-8859-1))
[...]
> I can't figure out if/where these kinds of things about the X11
> selection protocol is described, but at least in `xclip` they have
> a hack specifically for this case:
>
> [...]
> if (html != None && sel_type == html) {
> /* if the buffer contains UCS-2 (UTF-16), convert to
> * UTF-8. Mozilla-based browsers do this for the
> * text/html target.
> */
> [...]
>
> and according to the subsequent code it's not even always the
> same endianness.
I think it would make sense for us to do the same here. It should be
easy enough for us to detect that the string is utf-16, I think? The
data has a BOM and everything...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 3 years and 193 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.