[Slogger] Hack for funny characters breaking the XML log
Ola Sverre Bauge
osbulb at gmail.com
Fri Jan 25 02:44:00 PST 2008
On line 952 in slogger.js, inserting
title = title.replace(/[^a-zA-Z0-9!:+?,. ]/g, function(str){return
'&#'+str.charCodeAt(0)+';'});
makes the XML log no longer choke on non-ASCII characters in page
titles. However, this makes the HTML log break out with an ugly case
of visible entities. My hack for *that* was to place into the HTML
templates this hideous piece of code (you may wish to avert your
eyes):
<head><link rel="stylesheet" href="slogger.css" type="text/css"/>
<script>
function unamp() {
var c = document.getElementsByTagName("td");
for (var i=0; i<c.length; i++) {
c[i].innerHTML = c[i].innerHTML.replace(/&/g, '&');
}
}
</script></head>
<body onLoad="unamp()">
Also, in the XML template:
<url><![CDATA[$url]]></url>
(I forget if that's actually needed. Can't hurt, anyway.)
More information about the Slogger
mailing list