Checklist
Summary
When a widget has bind="query-params" and the user sets a value with spaces, they are encoded as %20. If the code then sets another value in st.query_params, all spaces become encoded as +.
Reproducible Code Example
import streamlit as st
st.selectbox("Set query param `a`", options=("default", "value with spaces"), key="a", bind="query-params")
if st.button("Set query param `b`"):
st.query_params["b"] = "value with spaces"
Steps To Reproduce
- Try the code above
- Click on the first button
- Notice
?a=value%20with%20spaces encodes spaces as %20.
- Click on the second button
- Notice
?a=value+with+spaces&b=value+with+spaces encodes spaces as +, including the a query param from before.
Expected Behavior
I would expect spaces to always be encoded as +, as it has always been the case for st.query_params["b"] = "value with spaces".
Current Behavior
The spaces in values from widgets that have bind="query-params" are encoded as %20.
Is this a regression?
Debug info
- Streamlit version: 1.56.0
- Python version: 3.11.9
- Operating System: macOS
- Browser: Chrome
Additional Information
No response
Checklist
Summary
When a widget has
bind="query-params"and the user sets a value with spaces, they are encoded as%20. If the code then sets another value inst.query_params, all spaces become encoded as+.Reproducible Code Example
Steps To Reproduce
?a=value%20with%20spacesencodes spaces as%20.?a=value+with+spaces&b=value+with+spacesencodes spaces as+, including theaquery param from before.Expected Behavior
I would expect spaces to always be encoded as
+, as it has always been the case forst.query_params["b"] = "value with spaces".Current Behavior
The spaces in values from widgets that have
bind="query-params"are encoded as%20.Is this a regression?
Debug info
Additional Information
No response