【发布时间】:2021-08-20 19:34:12
【问题描述】:
我正在尝试使用 Deno 读取用户输入,但我遇到了编码问题。
这是我输入“áé”时来自 Deno shell 的简单代码:
> const a = prompt('Insert your character:');
Insert your character: áé
undefined
> a
"��"
我的 Windows 命令提示符有 CP-1252 中的编码,与 ISO-8859-1 非常相似。
如何告诉 Deno 我输入的字符串的编码?或者我如何从 cp-1252 解码它?
【问题讨论】:
-
目前我不清楚这是否是 Deno
prompt中的一个问题,或者它是否总是使用 UTF-8 是有意和期望的行为。我已经开始讨论,您可能想关注/加入以了解更多信息:Should prompt always use UTF-8 even when the connected console may be using a different encoding? · Discussion #11773 · denoland/deno
标签: unicode character-encoding deno