Let's say I send a request with JavascriptJavaScript:
fetch("/query?q=" + encodeURIComponent("c'est un château? Yes & no!"));
fetch("/query?q=" + encodeURIComponent("c'est un château? Yes & no!"));
to a Python Bottle server:
from bottle import Bottle, request
app = Bottle("")
@app.route("/query")
def query():
q = request.query.get("q") # how to decode it?
print(q)
app.run()
from bottle import Bottle, request
app = Bottle("")
@app.route("/query")
def query():
q = request.query.get("q") # how to decode it?
print(q)
app.run()
How to decode request.query.get("q") so that it extracts the encodeURIComponent encoding?
Note: In this example, the ? and & are correctly decoded, but the â is not: print(q) gives c'est un château? Yes & no!
Let's say I send a request with Javascript:
fetch("/query?q=" + encodeURIComponent("c'est un château? Yes & no!"));
to a Python Bottle server:
from bottle import Bottle, request
app = Bottle("")
@app.route("/query")
def query():
q = request.query.get("q") # how to decode it?
print(q)
app.run()
How to decode request.query.get("q") so that it extracts the encodeURIComponent encoding?
Note: In this example, the ? and & are correctly decoded, but the â is not: print(q) gives c'est un château? Yes & no!
Let's say I send a request with JavaScript:
fetch("/query?q=" + encodeURIComponent("c'est un château? Yes & no!"));
to a Python Bottle server:
from bottle import Bottle, request
app = Bottle("")
@app.route("/query")
def query():
q = request.query.get("q") # how to decode it?
print(q)
app.run()
How to decode request.query.get("q") so that it extracts the encodeURIComponent encoding? In this example, the ? and & are correctly decoded, but the â is not: print(q) gives c'est un château? Yes & no!
Let's say I send a request with Javascript:
fetch("/query?q=" + encodeURIComponent("Is that"c'est aun questionchâteau? Yes & no!"));
to a Python Bottle server:
from bottle import Bottle, request
app = Bottle("")
@app.route("/query")
def query():
q = request.query.get("q") # how to decode it?
print(q)
app.run()
How to decode request.query.get("q") so that it extracts the encodeURIComponent encoding?
Note: In this example, the ? and & are correctly decoded, but the â is not: print(q) gives c'est un château? Yes & no!
Let's say I send a request with Javascript:
fetch("/query?q=" + encodeURIComponent("Is that a question? Yes & no!"));
to a Python Bottle server:
from bottle import Bottle, request
app = Bottle("")
@app.route("/query")
def query():
q = request.query.get("q") # how to decode it?
app.run()
How to decode request.query.get("q") so that it extracts the encodeURIComponent encoding?
Let's say I send a request with Javascript:
fetch("/query?q=" + encodeURIComponent("c'est un château? Yes & no!"));
to a Python Bottle server:
from bottle import Bottle, request
app = Bottle("")
@app.route("/query")
def query():
q = request.query.get("q") # how to decode it?
print(q)
app.run()
How to decode request.query.get("q") so that it extracts the encodeURIComponent encoding?
Note: In this example, the ? and & are correctly decoded, but the â is not: print(q) gives c'est un château? Yes & no!
Parameter encoded with encodeURIComponent, how to get it in a Python Bottle server?
Let's say I send a request with Javascript:
fetch("/query?q=" + encodeURIComponent("Is that a question? Yes & no!"));
to a Python Bottle server:
from bottle import Bottle, request
app = Bottle("")
@app.route("/query")
def query():
q = request.query.get("q") # how to decode it?
app.run()
How to decode request.query.get("q") so that it extracts the encodeURIComponent encoding?