tcp.im, jabber & XML entity problems

Matt Mower mmower at novissio.com
Tue Aug 5 14:17:04 PDT 2003


Hi there,

I'm just getting up to speed with the TCP.IM verbs in Frontier.  I've
added callbacks to webEdit to send an IM whenever an object is modified,
this works very well except when the object is in a table path like:

	
site002095.["#contents"].EntDirectory.xmlTable.["00001000\tdirectory"].[
"00149000\tnode"]

Here the message contents comes through as:

	
site002095.["#contents"].EntDirectory.xmlTable.["00001000
\tdirectory"].["00149000\tnode"]

>From a tcp traffic dump I am seeing the following coming into my jabber
client:

	<message from='frontier at linux.evectors.it/Frontier'
to='matt at linux.evectors.it' type='chat'>
	<body>05/08/2003; 23.00.52 : Matt Mower : CHECKS OUT :
site002095.[&amp;quot;#contents&amp;quot;].EntDirectory.xmlTable.[&amp;q
uot;00001000\tdirectory&amp;quot;].[&amp;quot;00148000\tnode&amp;quot;]<
/body>
	</message><message from='frontier at linux.evectors.it/Frontier'
to='matt at linux.evectors.it' type='chat'>
	<body>05/08/2003; 23.00.58 : Matt Mower : CHECKS IN :
site002095.[&amp;quot;#contents&amp;quot;].EntDirectory.xmlTable.[&amp;q
uot;00001000\tdirectory&amp;quot;].[&amp;quot;00148000\tnode&amp;quot;]<
/body>
	</message>	

It looks as if there is double escaping of certain XML entities going
on.  I took a look at tcp.im.builtInDrivers.jabber.messages.message()
and noticed the following:

	bundle { // text = xml.entityEncode(text,true)
		text = xml.entityEncode (text, false);
		text = string.replaceall (text, "&", "&amp;")
		text = string.replaceall (text, "<", "&lt;")
		text = string.replaceall (text, ">", "&gt;")
		text = string.replaceall (text, "\"", "&quot;")
		text = string.replaceall (text, "'", "&apos;")
	}

Just as a test I commented out all the string.replaceAll()'s from that
bundle.  Once I had done so the example I gave above started coming
through properly as:

	
site002095.["#contents"].EntDirectory.xmlTable.["00001000\tdirectory"].[
"00149000\tnode"]

I also tried a simple case like:

	tcp.im.send( "jabber", "matt at linux.evectors.it", "This <is> a
'test'" )

and this came through properly as:

	This <is> a 'test'

So I'm not sure what those extra replacements achieve.  Can they be
safely removed?  And, if so, can Userland remove them at source?
Otherwise what is the safe way of avoiding the double encoding problem?

Regards,

Matt

----
Business: http://www.novissio.com/
Personal: http://matt.blogs.it/





More information about the Frontier-Users mailing list