esbuild icon indicating copy to clipboard operation
esbuild copied to clipboard

SVG loader and and of lines

Open ecochard opened this issue 10 months ago • 1 comments

my svg contains end of lines when I import it, it is uriencoded

import logo from "logo.svg"

the logo variable contains %0A sequences instead of \n (or nothing)

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="647" height="145">
</svg>

is converted to

<?xml version="1.0" encoding="UTF-8"?>%0A<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="647" height="145">%0A</svg>

is that standard ?

ecochard avatar Apr 15 '25 14:04 ecochard

That depends on how you loaded it. The text loader uses \n while the dataurl loader uses %0A. They are both the standard ways to encode the newline character in those formats.

evanw avatar Apr 16 '25 00:04 evanw