parse-data-url icon indicating copy to clipboard operation
parse-data-url copied to clipboard

Fails to parse utf8 encoded json

Open TheWisestOne opened this issue 2 years ago • 1 comments

Honestly I'm not 100% sure if these are valid, but I have encountered data URIs that look like this:

data:application/json;utf8,{"key":"some value"}

OR

data:application/json,{"key":"some value"}

Running parseDataUrl on these returns false, so I have to special case these in my code. Raising this issue in case these should be supported by the library, but I will defer to public opinion on if this is in line with the data url specification

TheWisestOne avatar Oct 24 '23 01:10 TheWisestOne

@TheWisestOne Thank you for letting me know about the issue. I think I will patch the lib on the week-end to make sure that the case data:application/json,{"key":"some value"} will work. I found a problem.

Regarding data:application/json;utf8,{"key":"some value"} - need to research a bit more.

P.S. If it's urgent you can use the following one: https://github.com/jsdom/data-urls right now. Both your examples work correctly with it.

killmenot avatar Oct 24 '23 17:10 killmenot