from app import app from flask import Response @app.route("/hello_gb2312_failed") def hello_gb2312_failed(): headers = {"Content-Type": "text/html"} data = """ 你好世界 """.encode( "gb2312" ) return Response(data, headers=headers)