SVG files are converted to a Python bytes representation instead of decoded text
On dev (5c7285e), svg(svgfile=...) wraps the bytes returned by loadfile in str(). A UTF-8 SVG containing a newline or non-ASCII text therefore sends Python byte escapes instead of the original markup. The equivalent svg(svgstr=...) call preserves the text.
Reproduction: write <svg><text>café 世界</text> </svg> as UTF-8, then capture the payload of svg(svgfile=path) and compare it with svg(svgstr=markup). Expected: identical SVG content. Actual: escaped UTF-8 bytes and newline characters in the file payload.
This follows the historical bytes workaround discussed in closed issue #252. A regression test on current dev reproduces the mismatch for real newlines, Unicode, and literal backslash sequences. I have prepared a bounded UTF-8 decoding fix and tests. Investigated with AI assistance.
Source: fossasia/visdom