sách gpt4 ăn đã đi

Javascript 编码

In lại Tác giả: Walker 123 更新时间:2023-11-30 13:23:04 31 4
mua khóa gpt4 giày nike

我有一个外部链接的 javascript 文件。在那个 javascript 里面,我有这个功能:

function getMonthNumber(monthName){
monthName = monthName.toLowerCase();
if(monthName == 'janvier'){
return "01";
}else if(monthName == 'février'){
return "02";
}else if(monthName == 'mars'){
return "03";
}else if(monthName == 'avril'){
return "04";
}else if(monthName == 'mai'){
return "05";
}else if(monthName == 'juin'){
return "06";
}else if(monthName == 'juillet'){
return "07";
}else if(monthName == 'août'){
return "08";
}else if(monthName == 'septembre'){
return "09";
}else if(monthName == 'octobre'){
return "10";
}else if(monthName == 'novembre'){
return "11";
}else if(monthName == 'décembre'){
return "12";
}

但是,当我在 Firebug 中阅读它时,我看到:

function getMonthNumber(monthName){
monthName = monthName.toLowerCase();
if(monthName == 'janvier'){
return "01";
}else if(monthName == 'février'){
return "02";
}else if(monthName == 'mars'){
return "03";
}else if(monthName == 'avril'){
return "04";
}else if(monthName == 'mai'){
return "05";
}else if(monthName == 'juin'){
return "06";
}else if(monthName == 'juillet'){
return "07";
}else if(monthName == 'août'){
return "08";
}else if(monthName == 'septembre'){
return "09";
}else if(monthName == 'octobre'){
return "10";
}else if(monthName == 'novembre'){
return "11";
}else if(monthName == 'décembre'){
return "12";
}
}

因此,基本上所有的重音都被编码了。

据我在网上找到的,将字符集传递给脚本应该可以解决这个问题,但即使我尝试传递 charset="utf8" hoặc charset="ISO-8859 -1",似乎都不起作用。

我不确定如何解决这个问题。有什么想法吗?

câu trả lời hay nhất

让服务器在 HTTP header 中指定使用 charset=utf-8 的编码(值中带有连字符;utf8 不正确)。如果问题仍然存在,请发布 URL;可能由于某种原因,HTTP header 未按预期发送。

关于Javascript 编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9540661/

31 4 0
Walker 123
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress