spinel_kit 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/spin.toml +1 -1
- data/spinel_kit/url.rb +16 -10
- data/spinel_kit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84664f6fb19c07c1e9d4db180b7f9eb34a0499e6210de5acc764708b923aed72
|
|
4
|
+
data.tar.gz: 4a7894dca8991b6daf713423d04b33e35ef48678de58ea53112267a9cd7d679a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0599c94cabe3f168c4b1262e70dc66ef71eb2b9fc4a986e258a0040f1951c1e0ce59441f5d9eb881d251e16de7774ef0eb6a5f9b4b50c05969ccce9c2b6ebb9
|
|
7
|
+
data.tar.gz: 66a6080818ef6dd1d0ed4e9f19567ba903c4109cec84427971d7264cb3d316953db200c1fba64bab840f366a369f53b4bed789b253a43f788c2383092d6bce9d
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to SpinelKit are documented here.
|
|
4
4
|
|
|
5
|
+
## [0.3.1] - 2026-11-12
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **`SpinelKit::Url.escape` dropped all but the first byte of a multi-byte
|
|
9
|
+
character.** It indexed with `String#[]` and encoded `c.getbyte(0)`, on the
|
|
10
|
+
documented premise that `[]` indexes bytes under Spinel. It does not —
|
|
11
|
+
`"café".length` is 4 there and `[3]` is a two-byte `"é"` — so `"café"`
|
|
12
|
+
escaped to `"caf%C3"` on both runtimes, and that does not unescape back.
|
|
13
|
+
It now walks `bytesize`/`getbyte`. ASCII input and the `.b` form that the
|
|
14
|
+
parity test used are unchanged; what changes is that a plain UTF-8 string
|
|
15
|
+
now answers the same as its binary form.
|
|
16
|
+
|
|
5
17
|
## [0.3.0] - 2026-07-09
|
|
6
18
|
|
|
7
19
|
### Changed
|
data/spin.toml
CHANGED
data/spinel_kit/url.rb
CHANGED
|
@@ -42,20 +42,26 @@ module SpinelKit
|
|
|
42
42
|
# (ALPHA / DIGIT / `-._~`); the rest becomes `%XX` with UPPERCASE hex.
|
|
43
43
|
# (Space -> `%20`, not `+` -- this is the URI-component, not form, encoder.)
|
|
44
44
|
#
|
|
45
|
-
# Byte-oriented
|
|
46
|
-
# UTF-8
|
|
47
|
-
#
|
|
45
|
+
# Byte-oriented, and it walks BYTES to be so: `bytesize`/`getbyte` mean
|
|
46
|
+
# a multi-byte UTF-8 character becomes the %XX of each of its bytes on
|
|
47
|
+
# both runtimes, with no binary-string dance at the call site.
|
|
48
|
+
#
|
|
49
|
+
# It used to index with `String#[]` and encode `c.getbyte(0)` -- the
|
|
50
|
+
# FIRST byte of the character -- on the premise that `[]` indexes bytes
|
|
51
|
+
# under Spinel. It does not: `"caf\u00e9".length` is 4 there and `[3]`
|
|
52
|
+
# is a two-byte "\u00e9", so every byte but the first was DROPPED and
|
|
53
|
+
# "caf\u00e9" escaped to "caf%C3", which does not unescape back.
|
|
48
54
|
def self.escape(s)
|
|
49
55
|
out = ""
|
|
50
56
|
i = 0
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
n = s.bytesize
|
|
58
|
+
while i < n
|
|
59
|
+
b = s.getbyte(i)
|
|
60
|
+
if (b >= 0x61 && b <= 0x7A) || (b >= 0x41 && b <= 0x5A) ||
|
|
61
|
+
(b >= 0x30 && b <= 0x39) || b == 0x2D || b == 0x2E ||
|
|
62
|
+
b == 0x5F || b == 0x7E
|
|
63
|
+
out = out + b.chr
|
|
57
64
|
else
|
|
58
|
-
b = c.getbyte(0)
|
|
59
65
|
out = out + "%" + Hex.nibble_char(b / 16) + Hex.nibble_char(b % 16)
|
|
60
66
|
end
|
|
61
67
|
i += 1
|
data/spinel_kit/version.rb
CHANGED