I'm using a WebView to display an SVG image in my Android app. It worked without any issues up to Chrome 71, but since the update to Chrome 72 I'm getting a parser error:
error on line 21 at column 19: AttValue: ' expected
Line 21 is this one, and column 19 is the #
:
<g clip-path="url(#clip1)">
If I skip over that line, I get the same error on the next line, complaining about the #efefef
:
<g fill-opacity="1" fill-rule="evenodd" stroke="none" fill="#efefef">
It appears like the #
is causing some issues with Chrome 72. How can I fix that?
It seems to be a bug in Chrome. Might be somewhat related to this issue.
I'm loading the SVG with webview.loadData(svg, "image/svg+xml", "utf-8")
, and if I encode the #
with %23
it's working. But why would I have to encode the data by myself?