diff libpurple/util.h @ 27475:57fdb7853fc7

Create a purple_markup_escape_text() function and use it in one place in oscar. This function is identical to glib's g_markup_escape_text() except that it does not replace ' with ' ' is not a valid HTML entity in HTML 4, and IE7 displays it as the raw characters and not as an apostrophe. gtk of course displays it as an apostrophe, but gtk seems to have no problems with unescaped apostrophes I really don't know why g_markup_escape_text() escapes this character. So this change should not affect Pidgin at all, and it should help any user of libpurple who displays our HTML in IE (or possibly other web browsers--I'm not sure how webkit handles ') Are people ok with this change? We should probably change a lot of other places to use this function instead of the glib one. Basically anything that converts text to html should use this. I think anything that escapes XML should continue using g_markup_escape_text(). And entry_key_pressed() in Finch can be changed to use this instead of g_markup_escape_text() and purple_strreplace()
author Mark Doliner <mark@kingant.net>
date Mon, 06 Jul 2009 23:46:56 +0000
parents 6bd7b3e06233
children 66425e99d741
line wrap: on
line diff
--- a/libpurple/util.h	Mon Jul 06 23:24:37 2009 +0000
+++ b/libpurple/util.h	Mon Jul 06 23:46:56 2009 +0000
@@ -415,6 +415,17 @@
 /*@{*/
 
 /**
+ * Escapes special characters in a plain-text string so they display
+ * correctly as HTML.  For example, & is replaced with &amp; and < is
+ * replaced with &lt;
+ *
+ * This is exactly the same as g_markup_escape_text(), except that it
+ * does not change ' to &apos; because &apos; is not a valid HTML 4 entity,
+ * and is displayed literally in IE7.
+ */
+gchar *purple_markup_escape_text(const gchar *text, gssize length);
+
+/**
  * Finds an HTML tag matching the given name.
  *
  * This locates an HTML tag's start and end, and stores its attributes