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) .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3f49d-4482d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3f49d-4482d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?