It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center。
7年前关闭。
此对象UTF-8中的数字是否兼容/允许?
我不太确定,但是我听说UTF-8是一个标准,我想确保如果我在整个Javascript中都使用此对象,那么它将在UTF-8兼容的上下文中工作。
7年前关闭。
此对象UTF-8中的数字是否兼容/允许?
我不太确定,但是我听说UTF-8是一个标准,我想确保如果我在整个Javascript中都使用此对象,那么它将在UTF-8兼容的上下文中工作。
var specialOnes = {
0 : "cero",
1 : "uno",
2 : "d\xF3s", // "dos" with accent
3 : "tr\xE9s", // "tres" with accent
4 : "cuatro",
5 : "cinco",
6 : "s\xE9is", // "seis" with accent
7 : "siete",
8 : "ocho",
9 : "nueve",
};
最佳答案
通过兼容,您会问字符串在所有环境中是否都将解释为相同?
如果是这样,则是的,它们已正确编码,现代浏览器,javascript中断器等的所有实现都能够读取各种utf编码。
唯一可能出现的错误是由于您错误地输入了上述字符串或未指定字符集为utf-8。