qq15725 / modern-screenshot

πŸ“Έ Quickly generate image from DOM node using HTML5 canvas and SVG

Home Page:https://toolpkg.com/html-to-image

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when rendering emoji on Safari

DontGiveAFck opened this issue Β· comments

Steps To Reproduce

  1. open https://modern-screenshot.vercel.app/ on Safari 17.1 macos
  2. add emoji symbol to the page (πŸ˜€)
  3. notice that there is an error in console
image
Unhandled Promise Rejection: URIError: String contained an illegal UTF-16 sequence.

<!-- Provide a log message if relevant -->

Your Environment

  • modern-screenshot version on test env
  • Safari 17.1, macOS Sonoma 14.1.1, apple chip

I had same problem here. After a bit of browsing of the code I found the removeControlCharacter flag and setting that to false seems to fix the issue. Note sure what the flag is supposed to do but it seems it removes too much.

So adding this to options should do the trick:

let options = {
  features: {
    removeControlCharacter: false
  }
}

I had same problem here. After a bit of browsing of the code I found the removeControlCharacter flag and setting that to false seems to fix the issue. Note sure what the flag is supposed to do but it seems it removes too much.

So adding this to options should do the trick:

let options = {
  features: {
    removeControlCharacter: false
  }
}

Thanks. you saved my day