Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special character in SVG-text-nodes will cause a XML error 5617 #4

Open
herr-barus opened this issue Jan 4, 2015 · 2 comments
Open

Comments

@herr-barus
Copy link

Special character like öäüß in SVG-text-nodes will cause a XML error 5617 when using window.btoa for base64 encoding.
console:
SVG.toDataURL: using native renderer for png export. THIS MIGHT FAIL.
SVG.toDataURL: using standard XMLSerializer.serializeToString
SVG.toDataURL: using window.btoa for base64 encoding
XML5617: Ungültiges XML-Zeichen. Zeile: 9, Spalte 163

Forcing a custom encoding using the base64.js will work in actual FF, Chrome & Opera, but throws a SecurityError in IE in line 95 of svg_todataurl.js.
console:
SVG.toDataURL: using native renderer for png export. THIS MIGHT FAIL.
SVG.toDataURL: using standard XMLSerializer.serializeToString
SVG.toDataURL: using custom base64 encoder
SVG.toDataURL: exported image size: 0,0
SCRIPT5022: SecurityError Datei: svg_todataurl.js, Zeile: 95, Spalte: 1

@ghost
Copy link

ghost commented Mar 6, 2018

I can confirm the error.

I also tried to encode the character using unicode:
ä ---> ä

Still failed with following errors:

SVG.toDataURL: using native renderer for png export. THIS MIGHT FAIL.
svg_todataurl.js:46 SVG.toDataURL: using standard XMLSerializer.serializeToString
svg_todataurl.js:46 SVG.toDataURL: using window.btoa for base64 encoding
svg_todataurl.js:136 Can't export! Maybe your browser doesn't support SVG in img element or SVG input for Canvas drawImage?
http://en.wikipedia.org/wiki/SVG#Native_support

@bailon
Copy link

bailon commented Nov 30, 2018

I have the exact same issue from the cases above. It happens with almost every "special character", such as ä, é, €.

I could fix this using the following method before using the lib:
unescape(encodeURIComponent(svgData))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants