I’m running into an issue with certain escaped characters in a chat message body. Things like quotes and apostrophes are immediately escaped (which is valid) but I’m wondering if there is an easy way to disable this for a particular message type (Message.type.chat) or if there is some sort of client side formatting to convert things to different unicode characters.
Asking something like this is usually a sign that you try to pursue the wrong path.
Let us go one step back: What are you trying to solve?
I’m trying to make sure characters like apostrophe and quote are capable of being used with a message body for a chat message. Some languages use those two forms of punctuation with the unicorn characters that are being escaped. On the other client those are also not being rendered correctly (which is currently out of the realm of possibility to be corrected).
Essentially all I need is an easy way to send the correctly formatted string into a Message.type.chat body without being escaped.
What I found as a workable solution is to go through the string that is being passed in and swap any unicode characters that are reserved by smack in the StringUtils file and use different unicode characters I have found in place of it…
Is there not a first-party supported way of sending properly formatted quotes and conjunctions through smack using that message body?
I’m trying to make sure characters like apostrophe and quote are capable of being used with a message body for a chat message.
Is there not a first-party supported way of sending properly formatted quotes and conjunctions through smack using that mess
That is already the case. Escaping is not a single operation, there is the dual of unescaping on the receiving side.
Escaping and Unescaping is done at the XML layer. The application layer on the receiving side sees the same string that the sending side put into the message body.
Would be pretty stupid if that was not the case.
Looks like there is something wrong on our receiving side. What do you use there?
I agree however the client I’m communicating with is not properly unescaping characters and I’m attempting to find a solution to remedy that effect before having a different team (that isn’t within my ability to change) go and so some work to correct it (which I agree with you should be done in the correct way).
It’s an internal communication tool that is proprietary. There are ways to change it but the process can be extremely slow.
Then, yes, you probably want to exchange the escaped XML characters by similar Unicode counterparts (if that’s possible). But that’s a problem to be solved on the layers above Smack.