alexlenail / NN-SVG

Publication-ready NN-architecture schematics.
http://alexlenail.me/NN-SVG/
MIT License
4.49k stars 579 forks source link

Unicode characters not supported #34

Closed Pavo98 closed 4 years ago

Pavo98 commented 4 years ago

Can you add support for unicode characters in layer description? Right now it raises following error when "Download SVG" is clicked:

LeNet.html:371 Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range. at HTMLAnchorElement. (http://alexlenail.me/NN-SVG/LeNet.html:371:63) at HTMLAnchorElement. (https://d3js.org/d3.v5.min.js:2:10935)

I found this solution online: btoa(unescape(encodeURIComponent(str)))

alexlenail commented 4 years ago

Hi @Pavo98. In fact, that's what I have in the code:

https://github.com/alexlenail/NN-SVG/blob/f99ca4363f9b71398ce7504d72314244dddde43e/index.html#L357

Someone had this issue before, and it had to do with an extension they had on their browser. Could you please reproduce on a few browsers, and if so, please send me the string which you can't download?

Pavo98 commented 4 years ago

That is fixed just for FCN in file index.html. In LeNet.html it doesn't have that: https://github.com/alexlenail/NN-SVG/blob/f99ca4363f9b71398ce7504d72314244dddde43e/LeNet.html#L371

I have issues in Chrome 83.0 and Firefox 77.0 both are 64-bit. Problematic string is "Sloj sažimanja" where "ž" is the problem.

alexlenail commented 4 years ago

Thanks for reporting, @Pavo98. Please verify your issue is fixed.

Pavo98 commented 4 years ago

It is fixed. Thanks @alexlenail.