XMLUtil encoding problem

4 replies [Last post]
Anonymous

Hi,

We have in our database something like this

<contact ... name="&quot;abc&quot;" ...>

When this contact is sent to the client, the name attribute is encoded to

<contact ... name="&amp;quot;abc&amp;quot;" ...>

and it makes the client display the name as "&quot;abc&quot;" I traced the code and look like it encode the "&" to "&amp;" and leaves the "quot;" alone.

kobit's picture
Offline
Joined: 2006-09-03
Points: 267814

I think Tigase behaves correctly, it delivers to the client exactly what is in database and I it seems to me this is the right thing to do.
The question is, why such thing is in database. This is something wrong with either Tigase saving data to database or something bad happening during contact processing.
What version of the Tigase server do you use?

Anonymous (not verified)

We have the latest 5.1.0b4 installed. The problem happens when adding contacts in XMPP clients (PSI+ or iJab) that have the double quote (") in the optional nickname. So if users enter "abc" for the nickname, it will show up in the window as "abc" As I said, the client will send "abc" to the server, and the server save it as is in database. And when requested by the client, it sends back &quot;abc&quot; and the client will decode it to "abc"

kobit's picture
Offline
Joined: 2006-09-03
Points: 267814

Hm, I would need to investigate it. I wonder which part, where exactly quote is changed to &quote;. Whether it is done by the client or by the server somewhere before saving to the database.
I am afraid I do not have a solution for this right now. I have added a ticket for this: https://projects.tigase.org/issues/431

Anonymous (not verified)

Here is the firebug trace

From client, right after clicking on Add button

<iq type='set' id='prJP'><query xmlns='jabber:iq:roster'><item jid='abc@abc.com' name='&quot;abc&quot;'><group></group></item></query></iq>

and eventually response by server

<iq to="abc@abc.net/abc..ie65fc.E29F2" xmlns="jabber:client" type="set" id="rsttig3"><query xmlns="jabber:iq:roster"><item ask="subscribe" name="&amp;quot;abc&amp;quot;" jid="abc@abc.com" subscription="none"><group/></item></query></iq><iq to="abc@abc.net/abc..ie65fc.E29F2" xmlns="jabber:client" type="set" id="rsttig4"><query xmlns="jabber:iq:roster"><item ask="subscribe" name="&amp;quot;abc&amp;quot;" jid="abc@abc.com" subscription="none"><group/></item></query></iq>

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.