Confirmation box didnt show hebrew

2019-09-16 11:02发布

问题:

I build my project in asp.net and for one of my frm I write script with confermation box.

The function works great beside the hebrew msg. ie and chrom showen "?" mark instead of the hebrew characters i wrote.

function ConfirmDeleteTeacher() {
    var confirm_value = document.createElement("INPUT");
    confirm_value.type = "hidden";
    confirm_value.name = "confirm_value";
    if (confirm("בלה בלה?")) {
        confirm_value.value = "Yes";
    } else {
        confirm_value.value = "No";
    }
    document.forms[0].appendChild(confirm_value);
}

回答1:

This seems like an encoding issue. Try saving your document with a different encoding, I would suggest UTF-8.

To do this in Visual Studio: Open the document, go to File -> Save as and in the dialog that opens, the Save button has an arrow with options. Choose "Save with encoding" and then choose the appropriate encoding.

Hope this helps



回答2:

Thanks but I sloved the problem by adding the configuration this definition

<system.web>
    <globalization requestEncoding="windows-1255"
    responseEncoding="windows-1255" />
</system.web>

now the hebrew is working :)