sindresorhus / one-thing

Set the text for the One Thing app
https://sindresorhus.com/one-thing
MIT License
137 stars 3 forks source link

Unicode escape sequences not correctly displayed in terminal output for `one-thing --get` command #5

Closed juratori closed 1 year ago

juratori commented 1 year ago

Actual text is "🐝 Finish dark mode"

$: one-thing --get
\ud83d\udc1d Finish **dark** mode

When running the command one-thing --get from the macos terminal, the output containing Unicode characters, such as emojis, is incorrectly encoded as Unicode escape sequences (e.g., \ud83d\udc1d). This leads to the display of escape sequences instead of the actual characters. The issue can be resolved by manually converting the escape sequences to their corresponding characters. I have resolved the issue by making the following modification to the return statement in index.js:

return stdout.trim().replace(/\\u([\dA-F]{4})/gi, (_, p1) => String.fromCodePoint(parseInt(p1, 16)));
$: one-thing --get
🐝 Finish **dark** mode