I'm trying to create a server that's compatible with an old Japanese game, by handling the hardcoded endpoints the client sends with a Flask application. Some of the requests send a Shift-JIS encoded message within the query string, like www.example.com/post?text=こんにちは
. Flask returns a 500 status code when it receives a string encoded in this way. If the query string only contains ASCII the request succeeds.
From a packet analysis in Wireshark, the query string contains a sequence of bytes encoded in Shift-JIS. In the access log the Shift-JIS encoded query shows up as a sequence of backslash-encoded characters, like "?text=\x8E\xD7\x82\xC8 ... HTTP/1.1"
.
How can I route Shift-JIS encoded queries in Flask?