-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New prompt, alert and confirm methods get confused when escaping special characters [ã] #8179
Comments
May have something to do with this. But not sure. |
Another example, this time with some kanji. console.log(prompt('My prompt: 你好;').trim()); Latin example: console.log(prompt('My prompt: ãõâêîôûüïáéíóúàèìòùç;').trim()); One more example: const a = prompt('Insert your character');
console.log(`a===a => ${a === 'a'}`); // When inserting the character 'a', returns true, as expected!
console.log(`ã===ã => ${a === 'ã'}`); // When inserting the character 'ã', returns false... |
Was looking at the rustyline crate and it seems to use utf16 for reading input: https://github.com/kkawakam/rustyline/blob/master/src/tty/windows.rs#L105 |
@piscisaureus I don't know if we can call this issue fully fixed. The output part of it is solved, it seems, but the input part of it is still nor recognizing special UTF-16 characters. For example, when running the code below and inserting the characters 'a' and 'ã', one at a time, this is what we get: const a = prompt('Insert your character');
console.log(`a===a => ${a === 'a'}`); // When inserting the character 'a', returns true, as expected!
console.log(`ã===ã => ${a === 'ã'}`); // When inserting the character 'ã', returns false, not what we expected. Maybe we can open a new issue just for the input part, or reopen this one. Edit: opened new issue. |
The new adition of prompt, alert and confirm methods are great news for all of us!! Glad to have those!
However, after the small #8146 issue, there is yet another unrelated problem with the new tools: special UTF-8 (maybe UTF-16?) characters (ãñõâêîôûü, for example):
It happens both on the alert/confirm/prompt message and on the return value. This does not happen on console.log, though. May be related or similar to old #5046.
deno 1.5.0
v8 8.7.220.3
typescript 4.0.3
The text was updated successfully, but these errors were encountered: