Garbled Chinese parameters passed into python3 flask restful

-sharp -*- coding: utf-8 -*-
from flask import Flask
from flask_restful import reqparse,Api, Resource
app = Flask(__name__)
api = Api(app)

parser = reqparse.RequestParser()
parser.add_argument("task")

class TodoList(Resource):
    def post(self):
        args = parser.parse_args()
        str1 = args["task"]
        print (str1)
        return str1,201
api.add_resource(TodoList, "/todos")

if __name__ == "__main__":
    app.run(debug=True)

enter

in cmd
curl http://localhost:5000/todos -d "task=" -X POST -v

what you want to return is

instead of

"\ufffd\u01bb\ufffd\ufffd"



I want to output Chinese in cmd, for example, the incoming parameter "financial remittance side". The value I want to appear is also the financial remittance side, not the ufffd encoding format. How to solve this problem? ask for the boss"s advice

.
Mar.07,2021

app.config['JSON_AS_ASCII'] = False

or

app.config.update(RESTFUL_JSON=dict(ensure_ascii=False))

this is a problem with windows's cmd, which is normal in Linux.


after combining the methods of the above two bigwigs, we OK


parser.add_argument ('task', type=unicode) .

Menu