modern-screenshot icon indicating copy to clipboard operation
modern-screenshot copied to clipboard

Error when rendering emoji on Safari

Open DontGiveAFck opened this issue 1 year ago • 2 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

DontGiveAFck avatar Dec 27 '23 09:12 DontGiveAFck

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
  }
}

jbergfi avatar Jan 10 '24 07:01 jbergfi

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

debugtheworldbot avatar May 22 '24 03:05 debugtheworldbot