activity-browser icon indicating copy to clipboard operation
activity-browser copied to clipboard

SVG export of Sankey fails with special characters

Open MaximeAgez opened this issue 2 years ago • 7 comments

The export of Sankeys in SVG seems to fail from time to time:

image

From what I've narrowed down, it seems to be when the activity being studied has special characters in its name. For example the activity I was trying to show had some french accents (é, è, à) in its name.

MaximeAgez avatar Jun 01 '22 17:06 MaximeAgez

@nabilahmed739 Would you know how we could fix this?

marc-vdm avatar Jun 02 '22 08:06 marc-vdm

@MaximeAgez Just to confirm, you don't get an error during export, but when opening it in the browser?

Can you: a) upload the faulty svg to this issue b) check if you can open it in a different browser or image program?

I quickly made an svg export with an ö in the name and didn't get the error, so it shouldn't be a general unicode problem: svg_export

haasad avatar Jun 02 '22 08:06 haasad

Also related: #784

@MaximeAgez, while not a permanent fix, what has helped in the linked issue is restarting AB. somehow, the exporter breaks in some situations.

I'm thinking this is a different issue, as in the other one, we didn't have special characters, but the intermediate fix may help.

marc-vdm avatar Jun 02 '22 12:06 marc-vdm

Sorry for the late reply. @haasad Yes the export works fine, it's only when opening in the browser that things go wrong.

Here is a file that bugs on my side: svg_export

I tried opening the file in Microsoft Edge and Firefox and both bug.

MaximeAgez avatar Jun 05 '22 13:06 MaximeAgez

@MaximeAgez There seems to be an issue with the exporter intermittently when the SVG is panned/zoomed. Have you tried "Reset Zoom" then "Download SVG"? This always worked for me. I'll try fix it by resetting the SVG before every export that way we dont have to press 2 buttons, will keep you posted.

nabilahmed739 avatar Jun 05 '22 14:06 nabilahmed739

I just tried re-exporting after doing "Reset zoom" but it still fails.

MaximeAgez avatar Jun 05 '22 14:06 MaximeAgez

@MaximeAgez I think I found the problem:

  • I downloaded your file -> original.svg
  • When I try to open it, it complains about character 5435 on line 229 which is indeed the éin consommation d'énergie
  • turns out that the svg is not utf-8 encoded, but iso-8859-1 (latin-1)
file -i original.svg
original.svg: image/svg+xml; charset=iso-8859-1
  • if I convert the file to utf-8 I can open it without issues:
iconv -f iso-8859-1 -t utf-8 original.svg > converted.svg

converted

We'll have to check how to make sure the svg is exported as a utf-8 encoded file

haasad avatar Jun 07 '22 08:06 haasad