In SpiderMonkey, input from readline() does not handle UTF-8 data properly. If you are having trouble reading UTF-8 input, try something like the following.
function fromUTF8(str) {
return decodeURIComponent(escape(str));
}
const line = fromUTF8(readline());Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article