Encoding issues with Django Rest Framework and Android Volley Library

Recently I ran into a problem with encoding when I was trying to get a well-known Volley library to work with a Django Rest Framework. While making an API request with Volley I noticed that returning data is not properly encoded. I wanted to use class StringRequest to obtain response as it wasn’t clean JSON format. Sample code of StringRequest is presented below.

To make it work correctly with UTF-8 responses I extended the StringRequest class and modified  parseNetworkResponse method. Modified code is right here below.

I hope if anyone else has issues with that, this simple tutorial will help.

 

Leave a Reply

Your email address will not be published. Required fields are marked *