2020-08-27 10:07:46 +03:00
|
|
|
from flask import request, make_response
|
2022-02-14 11:13:33 +03:00
|
|
|
from app import app
|
2020-08-27 10:07:46 +03:00
|
|
|
from io import BytesIO
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/encoding/utf8")
|
|
|
|
def encoding_utf8():
|
2022-02-05 08:56:33 +03:00
|
|
|
return "café"
|
|
|
|
|
2020-08-27 10:07:46 +03:00
|
|
|
|
|
|
|
@app.route("/encoding/latin1")
|
|
|
|
def encoding_latin1():
|
|
|
|
result = BytesIO()
|
2022-02-05 08:56:33 +03:00
|
|
|
result.write(b"\x63\x61\x66\xe9")
|
2020-08-27 10:07:46 +03:00
|
|
|
data = result.getvalue()
|
|
|
|
resp = make_response(data)
|
2022-02-05 08:56:33 +03:00
|
|
|
resp.content_type = "text/html; charset=ISO-8859-1"
|
2020-08-27 10:07:46 +03:00
|
|
|
return resp
|