fix: can't open as image diagrams with non-Latin1 characters (#2402)
This commit is contained in:
1 parent
1961583eb6
commit
b7c03af9ac
2 files changed
+9
-1
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
---
|
||||
|
||||
fix: open diagrams with non-Latin characters (Hebrew, Arabic etc.)
|
||||
@@ -174,7 +174,10 @@ async function svgToPng(svgEl: SVGElement): Promise<string> {
|
||||
|
||||
const serializer = new XMLSerializer()
|
||||
const svgString = serializer.serializeToString(svgClone)
|
||||
const svgDataUrl = "data:image/svg+xml;base64," + btoa(decodeURIComponent(encodeURIComponent(svgString)))
|
||||
const encoder = new TextEncoder()
|
||||
const bytes = encoder.encode(svgString)
|
||||
const base64 = btoa(Array.from(bytes, (byte) => String.fromCharCode(byte)).join(""))
|
||||
const svgDataUrl = `data:image/svg+xml;base64,${base64}`
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const img = new Image()
|
||||
|
||||
Reference in new issue
Block a user