Fix Tornado HTTP Response Output Garbled Text – Tornado Tutorial

By | February 25, 2022

When we are using postman to test a web server api that is built by tornado, we may get a garbled text. For example:

Fix Tornado HTTP Response Output Garbled Text - Tornado Tutorial

In this tutorial, we will introduce you how to fix this problem.

How to fix garbled text in tornado?

We should set charset type for http response header.

For example:

self.set_header("Content-Type", "application/json;charset=UTF-8")

In this code, we will tell web server output utf-8 text.

Restart your web server, then test you api again, you will see:

Steps to Fix Tornado HTTP Response Output Garbled Text - Tornado Tutorial

Leave a Reply