[Freeswitch-dev] ESL events, header data in non-ascii characters and unicode hell

Anton VG anton.vazir at gmail.com
Wed Mar 28 22:59:42 MSD 2012


Some users enter their name in unicode (non ascii chars) - russian for
example or french

When using Python ESL in Python3 - I get this weird behavior.
ESLevent already attempted to be returned as a unicode str, and damn
Py3 attempts to unicode it before
I can catch an exception in the ESL.py code and remove the non ascii
chars or handle it another way.

(python 2 have been just passing the bytes over)

  File "/home/anton/GIT/auth_server/ESL/ESL.py", line 78, in getHeader
    def getHeader(self, *args): return _ESL.ESLevent_getHeader(self, *args)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xef in position 1:
invalid continuation byte

While the data is ascii or unicode correct, all OK.

Please help determine where I can tap in to have headers data to be
cast as bytes before passed over to PythonLIB

As ESL and other libs are automatically compiled using SWIG - I have
no idea yet where to look at.

Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list