mod_pastebin: Fix to not truncate UTF-8 sequences when creating a snippet summary for XHTML-IM (thanks DaiZW for discovering :) )
--- a/mod_pastebin/mod_pastebin.lua Sun Jun 27 15:04:24 2010 +0800
+++ b/mod_pastebin/mod_pastebin.lua Mon Jun 28 14:54:30 2010 +0100
@@ -74,7 +74,7 @@
--module:log("debug", " stanza[bodyindex] = %q", tostring( stanza[bodyindex]));
stanza[bodyindex][1] = url;
local html = st.stanza("html", { xmlns = xmlns_xhtmlim }):tag("body", { xmlns = xmlns_xhtml });
- html:tag("p"):text(body:sub(1,150)):up();
+ html:tag("p"):text(body:sub(1,150):gsub("[\128-\255]+$", "")):up();
html:tag("a", { href = url }):text("[...]"):up();
stanza[htmlindex or #stanza+1] = html;
end