You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Adds a new parameter `response_encoding` to the fetch function. - This
parameter allows the user to specify a charset for decoding the response
body. - It supports all standard web encodings, and also `hex` and
`base64`. - If no encoding is specified, the response is decoded as
utf-8, or as base64 if it contains binary data.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,11 @@
1
1
# CHANGELOG.md
2
2
3
+
## v0.37.0
4
+
- Added a new parameter `encoding` to the [fetch](https://sql-page.com/functions.sql?function=fetch) function:
5
+
- All [standard web encodings](https://encoding.spec.whatwg.org/#concept-encoding-get) are supported.
6
+
- Additionally, `base64` can be specified to decode binary data as base64 (compatible with [data URI](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs))
7
+
- By default, the old behavior of the `fetch_with_meta` function is preserved: the response body is decoded as `utf-8` if possible, otherwise the response is encoded in `base64`.
8
+
3
9
## v0.36.1
4
10
- Fix regression introduced in v0.36.0: PostgreSQL money values showed as 0.0
5
11
- The recommended way to display money values in postgres is still to format them in the way you expect in SQL. See https://github.com/sqlpage/SQLPage/issues/983
Copy file name to clipboardExpand all lines: Cargo.toml
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
[package]
2
2
name = "sqlpage"
3
-
version = "0.36.1"
3
+
version = "0.37.0"
4
4
edition = "2021"
5
5
description = "Build data user interfaces entirely in SQL. A web server that takes .sql files and formats the query result using pre-made configurable professional-looking components."
6
6
keywords = ["web", "sql", "framework"]
@@ -73,6 +73,7 @@ awc = { version = "3", features = ["rustls-0_23-webpki-roots"] }
73
73
clap = { version = "4.5.17", features = ["derive"] }
74
74
tokio-util = "0.7.12"
75
75
openidconnect = { version = "4.0.0", default-features = false }
76
+
encoding_rs = "0.8.35"
76
77
77
78
[build-dependencies]
78
79
awc = { version = "3", features = ["rustls-0_23-webpki-roots"] }
Copy file name to clipboardExpand all lines: examples/official-site/sqlpage/migrations/40_fetch.sql
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,7 @@ The fetch function accepts either a URL string, or a JSON object with the follow
87
87
- `timeout_ms`: The maximum time to wait for the request, in milliseconds. Defaults to 5000.
88
88
- `username`: Optional username for HTTP Basic Authentication. Introduced in version 0.33.0.
89
89
- `password`: Optional password for HTTP Basic Authentication. Only used if username is provided. Introduced in version 0.33.0.
90
+
- `response_encoding`: Optional charset to use for decoding the response body. Defaults to `utf8`, or `base64` if the response contains binary data. All [standard web encodings](https://encoding.spec.whatwg.org/#concept-encoding-get) are supported, plus `hex`, `base64`, and `base64url`. Introduced in version 0.37.0.
log::warn!("fetch(...) response is not UTF-8 and no encoding was specified. Decoding the response as base64. Please explicitly set the encoding to \"base64\" if this is the expected behavior.");
0 commit comments