[Pidgin] #17260: purple_unescape_html() leaves <span> tags

Pidgin trac at pidgin.im
Tue Oct 17 05:23:51 EDT 2017


#17260: purple_unescape_html() leaves <span> tags
--------------------+--------------------------
 Reporter:  dwmw2   |      Owner:  EionRobb
     Type:  defect  |     Status:  new
Milestone:          |  Component:  unclassified
  Version:  2.12.0  |   Keywords:
--------------------+--------------------------
 I am working on a PRPL in which messages are plain text. I used
 `purple_unescape_html()` to turn the message passed to my `->send_im()`
 function into something I can send on the wire.

 It doesn't always work. Users report that when they use a RTL language
 such as Hebrew, they end up actually sending `<SPAN style="direction:rtl
 ;text-align:right;">…` on the wire.

 This code at the start of my `->send_im()` function:
 {{{
         imd->message = purple_unescape_html(message);
         printf("Unescaped '%s' to '%s'\n", message, imd->message);
 }}}
 ... results in this output:
 {{{
 Unescaped '<SPAN style="direction:rtl;text-align:right;"><font
 size="3">‏</font>‫שלום</SPAN>' to '<SPAN style="direction:rtl;text-
 align:right;"><font size="3">‏</font>‫שלום</SPAN>'
 }}}
 I'm kind of confused by the rendering of that; it looks different when I
 paste it here, to where I copied it from in the terminal. So...
 {{{
 (gdb)
 301             imd->message = purple_unescape_html(message);
 (gdb)
 302             printf("Unescaped '%s' to '%s'\n", message, imd->message);
 (gdb) p message
 $1 = 0x17d9560 "<SPAN style=\"direction:rtl;text-align:right;\"><font
 size=\"3\">‏</font>‫שלום</SPAN>"
 (gdb) p imd->message
 $2 = (gchar *) 0x1ae0940 "<SPAN style=\"direction:rtl;text-
 align:right;\"><font size=\"3\">‏</font>‫שלום</SPAN>"
 (gdb) x/90c message
 0x17d9560:      60 '<'  83 'S'  80 'P'  65 'A'  78 'N'  32 ' '  115 's'
 116 't'
 0x17d9568:      121 'y' 108 'l' 101 'e' 61 '='  34 '"'  100 'd' 105 'i'
 114 'r'
 0x17d9570:      101 'e' 99 'c'  116 't' 105 'i' 111 'o' 110 'n' 58 ':'
 114 'r'
 0x17d9578:      116 't' 108 'l' 59 ';'  116 't' 101 'e' 120 'x' 116 't' 45
 '-'
 0x17d9580:      97 'a'  108 'l' 105 'i' 103 'g' 110 'n' 58 ':'  114 'r'
 105 'i'
 0x17d9588:      103 'g' 104 'h' 116 't' 59 ';'  34 '"'  62 '>'  60 '<'
 102 'f'
 0x17d9590:      111 'o' 110 'n' 116 't' 32 ' '  115 's' 105 'i' 122 'z'
 101 'e'
 0x17d9598:      61 '='  34 '"'  51 '3'  34 '"'  62 '>'  -30 '\342'
 -128 '\200'     -113 '\217'
 0x17d95a0:      60 '<'  47 '/'  102 'f' 111 'o' 110 'n' 116 't' 62 '>'
 -30 '\342'
 0x17d95a8:      -128 '\200'     -85 '\253'      -41 '\327'      -87 '\251'
 -41 '\327'      -100 '\234'     -41 '\327'      -107 '\225'
 0x17d95b0:      -41 '\327'      -99 '\235'      60 '<'  47 '/'  83 'S'  80
 'P'  65 'A'  78 'N'
 0x17d95b8:      62 '>'  0 '\000'
 }}}

--
Ticket URL: <https://developer.pidgin.im/ticket/17260>
Pidgin <https://pidgin.im>
Pidgin


More information about the Tracker mailing list