Closed airtonix closed 5 months ago
solution: don't forget <meta charSet="utf-8" />
in your head.
By default esbuild's output is ASCII-only. Any non-ASCII characters are escaped using backslash escape sequences. One reason is because non-ASCII characters are misinterpreted by the browser by default, which causes confusion. You have to explicitly add to your HTML or serve it with the correct Content-Type header for the browser to not mangle your code.
https://esbuild.github.io/api/#charset
so in my case: Remix, which means:
root.tsx
export function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
{children}
<ScrollRestoration />
<Scripts />
</body>
</html>
);
}
Remove <meta charSet="utf-8" />
and the problem appears.
Obviously it's not a problem with bundler-mdx
, but I guess it was unexpected behaviour; should we document this in the README?
mdx-bundler
version: 10.0.2node
version: v18.17.0npm
version: 9.6.7yarn
version: 4.0.2Relevant code or config
intro.md
mdxcollection.ts
What you did:
What happened:
So this doesn't end up rendering the emoji correctly anymore.
Reproduction repository:
I tried reproducing it here, but inexplicably it wont (perhaps because it's an in memory filesystem on stackblitz?).
https://stackblitz.com/edit/remix-run-remix-cqytcp?file=app%2Froutes%2F_index.tsx
Problem description:
unicode emoji is escaped.
Suggested solution:
š¤·š»