question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PNG Export character encoding

See original GitHub issue

Wanted to follow up on what I have been looking into. This is a follow up of the discussion in #1069

I started out out trying to write some tests for the export in cypress but ran into a couple of issues:

  1. Without modifying the app code, I could not figure out how pause execution of the code where the bug is present. After modifying the encoding and generating an image, the encoding changes are reverted immediatly
  2. Cypress does not handle file downloads particularly well for this use case right now

This lead me to try out using the open feature in carbon. The idea was load a specific snippet, open it, and compare the resulting image using something like cypress-image-snapshot. Unfortunatly cypress does not seem to be able to load blob: urls. If anyone knows a way around this please let me know!

Now I am looking into potentially fixing the encoding issues at the source - which would mean carbon could avoid having to deal with encoding at all. I have verified that this does in fact appear to be an issue in dom-to-image (see this sandbox). Unfortunatly dom-to-image was last updated in 2017 and does not appear to be actively maintained.

I found a fork that is active but unfortunatly in my testing it does not appear to be a drop in replacement. See the differences in the images below

dom-to-image

dom-to-image

dom-to-image-more

dom-to-image-more

It appears to be either a font or sizing issue. My concern would be that switching would also potentially uncover other variances that may be a pain to track down.

For now I am going to look into how difficult patching the original character encoding issues in dom-to-image would be. Suggestions appreciated!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
qw-incommented, Aug 14, 2020

@mfix22 Yeah I don’t expect it to get merged but figured I would open it for reference. Although the dom-to-image-more pr did get merged (https://github.com/1904labs/dom-to-image-more/pull/23) 🎉

I think at least short term a local version makes perfect sense! I was wondering about forking and releasing a scoped npm package (@carbon/dom-to-image has a nice ring 😄) but lib and patch-package are both great options!

I think you should make the call since you are the one who will likely have to maintain it - but happy to open a PR for whichever route!

0reactions
mfix22commented, Aug 16, 2020

@qw-in Very cool. Closing this issue with #1083, but please open a new one if you have other ideas to discuss.

Might be cool for Carbon to publish our dom-to-image w/ the fix you made, and maybe we can even incorporate the improvements made in https://www.npmjs.com/package/retina-dom-to-image. Not sure we want to maintain this library, but now we have to in some way 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with character encoding when exporting image using ...
Hello. I have the Grafana 2.1.3 version running on Ubuntu and use /render/dashboard-solo API to export .png images. good_albo_live.
Read more >
Possible bug in Export with CharacterEncoding ...
There seems to be a disregard for certain characters when Exporting with ASCII as the CharacterEncoding, regardless of their character codes ...
Read more >
Exporting objects using desired encoding always ends up with ...
Create an asset using characters from ISO-8859-15 charset: · Open object view > cog icon > Export objects · Select ISO-8859-15 encoding >...
Read more >
How to configure CSV exports to use UTF-8 charset
find_real_file.png OR. Note: By default, ServiceNow exports all CSV files in Windows-1252 encoding. If you need to export translated data, ...
Read more >
Export a scene or puppet - Adobe Support
You can also choose to export a scene frame as PNG. Export a scene as a movie file via Adobe Media Encoder. You...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found