-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 cmdcurl 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