UTF-8 content doesn't get properly serialized
igz-gp opened this issue · comments
Gabriel Palacios commented
Issue Summary
UTF-8 content doesn't get properly serialized
Steps to Reproduce
- Add any utf-8 content to a
VoiceResponse
. E.g.voice_response = VoiceResponse(); voice_response.say("An utf-8 character: ñ")
- Serialize the voice_response. E.g.
str(voice_response)
- The result is
'<?xml version="1.0" encoding="UTF-8"?><Response><Say>An utf-8 character: ñ</Say></Response>'
. Theñ
character was html encoded.
Technical details:
- twilio-python version: 7.15.0
- python version: 3.9.15
Proposed solution:
Replace xml = ET.tostring(self.xml()).decode('utf-8')
with xml = ET.tostring(self.xml(), encoding='utf-8').decode('utf-8')
in
twilio-python/twilio/twiml/__init__.py
Line 67 in 15eb9be
Gabriel Palacios commented
I could make a PR if you want me to :)
Jennifer Mah commented
Hi @igz-gp! Thanks for opening an issue! Please feel free to open a PR with a fix and our team will add it to our review backlog.