gpt4 book ai didi

javascript - Node.js 源代码需要什么编码?

转载 作者:数据小太阳 更新时间:2023-10-29 04:21:46 25 4
gpt4 key购买 nike

我进行了一些 Google 搜索,但得到的结果与编码字符串或文件有关。

我可以编写我的 Node.js JavaScript 源代码在 UTF-8 中吗?我可以在注释、字符串或变量名中使用非 ASCII 字符吗?

ECMA-262 似乎是 require UTF-16 encoding ,但 Node.js 不会运行 UTF-16 编码的 .js 文件。但是,它将运行 UTF-8 源代码并正确解释非 ASCII 字符。

那么这是有意为之还是“意外”造成的?是否在某处指定了支持 UTF-8 源代码?

最佳答案

引用:http://mathiasbynens.be/notes/javascript-identifiers

UTF-8 字符是有效的 javascript 变量名。继续编码 UTF-8。

关于javascript - Node.js 源代码需要什么编码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10125141/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com