Output of "fossil json config get skin" contains anomalous information
(1) By Marcelo Huerta (richieadler) on 2025-04-09 03:02:21 [source]
The output contains these values:
"icon-image":"‰PNG\r\n<0x1a>\n",
"icon-mimetype":"image/png",
"js":"",
"logo-image":"‰PNG\r\n<0x1a>\n",
"logo-mimetype":"image/png",
where <0x1a>
represents the byte with that hexadecimal value. No other representation of the PNG file attached for icon or logo is generated.
The chosen representation causes problems in Windows, as <0x1a> is Ctrl-Z, traditionally used as an EOF mark. Therefore other utilities (for instance jq
, which I used to attempt to format the output) fail to interpret the returned text as valid JSON.
(2) By Andy Bradford (andybradford) on 2025-04-09 04:12:52 in reply to 1 [link] [source]
> where <0x1a> represents the byte with that hexadecimal value. I think that JSON doesn't really have support for binary data other than perhaps sending it as a base64 encoded string and then having the client decode it. Andy
(3) By Mike Swanson (chungy) on 2025-04-09 05:54:49 in reply to 2 [link] [source]
That's probably the most sensible way to do it. Control characters, "
, and \
are not permitted in strings without escape sequences. It's doable to go that way, but base64 is way less likely to cause issues, just make sure both sides understand it is base64. :-)