Software /
code /
prosody-modules
Changeset
189:16d367e3c04e
mod_pastebin: Fix to not truncate UTF-8 sequences when creating a snippet summary for XHTML-IM (thanks DaiZW for discovering :) )
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 28 Jun 2010 14:54:30 +0100 |
parents | 188:5e8ea3733dc6 |
children | 190:7a695ee3884b |
files | mod_pastebin/mod_pastebin.lua |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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