The ask
Paul scanned a Wi-Fi code from the new QR Code Generator with his iPhone and reported that the password arrived with a double quote character at each end. This is a follow up fix to the tool added in Lab Note #74.
What changed
- The Wi-Fi payload no longer wraps an all-hexadecimal value in double quotes, for the network name or the password. Values are written literally.
- A password or a network name containing a semicolon now produces a visible warning. A reader that ignores the backslash escape would read that field short and fail with no explanation, and that cannot be settled without a phone.
- The page now loads qr-code-generator.02d38218d75e.js. Escaping of the reserved characters is unchanged.
How
I reproduced the payload for a hexadecimal password, read the Wi-Fi convention and a field write up of it, removed the quoting, updated the tests, then rebuilt the asset and pointed the page at it. Snapshot first, then the change, then the usual verify and sync.
What worked, what didn’t
- The cause. The Wi-Fi convention that phones follow says to wrap an all-ASCII value that could be read as hexadecimal in double quotes, so a reader does not decode it as hex bytes. My first version did that for the password as well as the network name. A password made only of hexadecimal characters, which includes an ordinary choice such as 12345678, was written as “12345678”. The iPhone showed the quotes, so it does not strip that wrapper.
- The write up I found states plainly that phone behaviour for that rule was never tested, and its own reference implementation quotes only the network name and never the password. That is a fair warning that the rule is not relied on in practice, and I should have treated it that way rather than applying it to every field.
- The fix. Quote nothing. A phone join prompt reads the value literally, so the quotes arrive as part of the password, and the ambiguity the quotes were meant to resolve does not arise on a phone, which does not decode a network name as hex bytes. Escaping stays, because a bare separator would truncate a field.
- Verified after the fix: the payload for a hexadecimal password is now
WIFI:T:WPA;S:Guest Network;P:12345678;;, and the PNG that Chrome downloaded decodes back to exactly that string with no quote characters. A four digit network name and a hex looking network name are also left unquoted. 177 automated checks pass, including encode and decode round trips through jsQR for a hexadecimal password, a four digit network name and a 64 digit key. - What I could not test: a real camera scan. I have no iPhone here, so the confirmation has to come from Paul. The same limit applies to a password containing a semicolon or a colon, where the reader has to honour the backslash escape. That is why it now warns instead of staying silent.
- The earlier asset qr-code-generator.32888d4c6611.js is left in the folder unreferenced, in line with how the previous SPF assets were kept. A Git rollback restores whichever one the restored page points at.
Change record
| Harness | opencode |
| Date | 2026-10-12 10:22 |
| Latest snapshot | 20261012-101628 |
| Undo this session | ops/rollback.sh --git 4a244e7 |
Commits