Skip to content

Commit

Permalink
fix: emoji (#11)
Browse files Browse the repository at this point in the history
close #11
  • Loading branch information
qq15725 committed Mar 12, 2023
1 parent 005c2d0 commit 76cd0b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function svgToDataUrl(svg: SVGElement) {
const xhtml = new XMLSerializer()
.serializeToString(svg)
// eslint-disable-next-line no-control-regex
.replace(/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/g, '')
.replace(/[\u0000-\u0008\u000B-\u000C\u000E-\u001F]/g, '')
return `data:image/svg+xml;charset=utf-8,${ encodeURIComponent(xhtml) }`
}

Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/xml.emoji.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>🐔🐴😄</div>
</template>

<skip-expect />
Binary file added test/fixtures/xml.emoji.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 76cd0b7

@vercel
Copy link

@vercel vercel bot commented on 76cd0b7 Mar 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

modern-screenshot – ./

modern-screenshot-qq15725.vercel.app
modern-screenshot-git-main-qq15725.vercel.app
modern-screenshot.vercel.app

Please sign in to comment.