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.

`ts.convertToBase64` does not handle emojis

See original GitHub issue

Bug Report

https://github.com/microsoft/TypeScript/blob/da00ba67ed1182ad334f7c713b8254fba174aeba/src/compiler/utilities.ts#L5244

> ts.convertToBase64("📣❓")
'7aC97bOj4p2T'
> Buffer.from("📣❓").toString("base64")
'8J+To+Kdkw=='

🔎 Search Terms

  • ts.convertToBase64
  • emojis

🕗 Version & Regression Information

Probably a long time.

⏯ Playground Link

N/A

💻 Code

ts.convertToBase64("📣❓")

🙁 Actual behavior

7aC97bOj4p2T

🙂 Expected behavior

8J+To+Kdkw==

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
RyanCavanaughcommented, May 19, 2022

Gotcha, we can make the fallback implementation as slow as needed

0reactions
dsherretcommented, May 18, 2022

By the way, when running on Node it uses ts.sys.base64encode, which uses Buffer.from(...).toString("base64"). So only non-Node environments are affected (issue doesn’t happen with tsc on Node).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to base64 encode emojis in JavaScript? - Stack Overflow
You can encode it by escaping it first and then calling EncodeUriComponent on it. This looks like this:.
Read more >
Manage emoji preferences - Slack
There are a few preferences for managing how emoji display in Slack: Display emoji as Unicode or plain text; Choose to make emoji...
Read more >
Emojis and Accessibility: The Dos and Don'ts of Including ...
Don'ts. Don't repeat an emoji over and over;; Don't place emojis throughout a message;; Don't put a call to action after the emoji....
Read more >
13 Do's and Don'ts of Using Emojis on Social Media
Emojis are everywhere. From texting to marketing to even home decor, you can't seem to go a day without seeing them.
Read more >
Emojis and accessibility: How to use them properly
Who doesn't love emojis? I'm willing to bet that the recent 10 messages you sent or received from different people on your phone,...
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