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.


One thought on “Encoding issues with Django Rest Framework and Android Volley Library

  1. Hi 🙂
    I had the same problem. I am wondering why it is still not resolved after 2 years 🙂 This hook is indeed helpful, but maybe you came up with an idea how to actually encode json requests in Django to make them readable in android via volley? I am not sure if it is optimal to send lots of data as a String 🙂

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.