[JDEV] Non english messages solution

Eugene Tyurkin john at if-site.com
Mon Apr 9 00:40:03 CDT 2001

Looks like you don't understand me correctly. So let's try again.

All I want to say is that jabber's ability to send everything in unicode
can solve ANY problems with characters encodings. If I'll convert message
to unicode using right charset (cp1251) so I can easily decode it to
enother charset (koi8-r). Here's example in python:

#I use python 1.5.2 in this example, so
#I include unicode support from pynicode python module
from pynicode.ustring import ustring

cp1251Text = "рШ ГДЕЯЭ?" #This is a text in cp1251 encoding

#I know that original text in cp1251 so I can convert it
#to unicode correctly
unicodeText = ustring('cp1251',cp1251Text)

#And know all we need is to get original message
#in koi8-r encoding
print "text in koi8-r:",utext.GetValue('koi8-r')

That's all. Actually all that client need is to use last line of example
code. All that agent need is the first lines. Sure it must be a little
more difficult in C to implement this but guess it's not a big problem.

BUT! Agent MUST know incoming encoding. So I suggest to include preferable
encoding to the registration protocol. For example when you register an
ICQ agent you must input you nickname, icq number and other things. So why
do not include encoding information? Once entered during registration you
will never be worry about incorrect character translation. Agent will
always know incoming encoding so it will have an ability to
correctly encode messages to unicode and back. Sure it can have a default
encoding so user can use it if it doesn't care, but in my case it has a big

By the way, it must be not only an icq agent problem but any other agents
too. That's why I suggest to include encoding information to the protocol

So what can YOU say?

More information about the JDev mailing list