fix raphael to svg with unicode
authorAlan Knowles <alan@roojs.com>
Tue, 15 Dec 2020 08:47:24 +0000 (16:47 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 15 Dec 2020 08:47:24 +0000 (16:47 +0800)
seed/toSVG.js

index 9d710a3..7cdfcb7 100644 (file)
@@ -281,6 +281,20 @@ function toSVG() {
 
     svg += '</svg>';
 
+    
+    function U2A(str)
+    {
+        var ret = '';
+        for (var i = 0;i < str.length; i++) {
+            ret += str.charCodeAt(i) > 254 ? ('&#' + str.charCodeAt(i) + ';') : str.charAt(i);
+        }
+        return ret;
+    }
+        
+    return U2A(svg);
+    
+    
+    
     return svg;
 };
  
\ No newline at end of file