Open zliuent opened 3 years ago
Here are steps can be used to verify the presence of the BOM, reproduce the problem and verify the fix
Format-hex green.svg
Format-hex green_tiny_ps.svg
Or you can run the following in Linux
hexdump -C green.svg
hexdump -C green_tiny_ps.svg
Comparing the two outputs, you can see the added UTF-8 BOM chars (EF BB BF) at the beginning of the green_tiny_ps.svg.
[System.Convert]::ToBase64String([IO.File]::ReadAllBytes(".\green_tiny_ps.svg"))
,
or
cat green_tiny_ps.svg | base64
You should be able to get output: 77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxzdmcgdmVyc2lvbj0iMS4yIiBiYXNlUHJvZmlsZT0idGlueS1wcyIgdmlld0JveD0iMCAwIDMwIDMwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KICA8dGl0bGU+R3JlZW48L3RpdGxlPg0KICA8ZGVzYz5BIFNpbXBsZSBTVkcgdGlueSBmaWxlPC9kZXNjPg0KICA8cmVjdCB4PSIxNSIgeT0iMTUiIHdpZHRoPSIxNSIgaGVpZ2h0PSIxNSIgZmlsbD0iZ3JlZW4iIC8+DQo8L3N2Zz4=
Repeat the steps above with the patched exe.
This works! good explanation @zliuent
Came across two cases where using the tiny ps file generated by svgconvernter.exe caused problems: The first case was that a BIMI certificate failed to pass https://www.mailkit.com/resources/bimi-inspector. The second case was that the browser displayed some extra question marks when rendering the inline svg data (obtained by base64 encoding the svgconvernter.exe output file, then decoding it back to UTF-8).
This type of problem could be fixed by enhancing each of the decoding application. It can also be fixed by removing BOM from UTF-8 output file when executing svgconvernter.exe. The latter approach could potentially save many developers from troubleshooting and fixing the decoder. In fact, using of a BOM is neither required nor recommended for UTF-8 based on Section 2.6 of the Unicode standard.
This issue report is tracking the BOM removal from UTF-8 output file.