# HG changeset patch # User Matthew Wild # Date 1277733270 -3600 # Node ID 16d367e3c04e33fb2c310cf6a9d9a1d155ba23a0 # Parent 5e8ea3733dc6958b156bf2dc9743006392596191 mod_pastebin: Fix to not truncate UTF-8 sequences when creating a snippet summary for XHTML-IM (thanks DaiZW for discovering :) ) diff -r 5e8ea3733dc6 -r 16d367e3c04e mod_pastebin/mod_pastebin.lua --- 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