im trying to use a jquery form validation, and i want the validating text to be arabic. the problem is that when i change that phrase in the .js file, it shows squares instead of arabic letters. this is my js file: $(document).ready(function(){// Place ID's of all required fields here. required =["name","email","country","message",];// If using an ID other than #email or #error then replace it here email = $("#email"); errornotice = $("#error");// The text to show up within a field when it is incorrect emptyerror ="Please fill out this field."; emailerror ="Please enter a valid e-mail."; so i want to change the last two lines "please fill..." and "please enter..." to arabic. and i already tried adding this code: charset=UTF-8 to the head, it still didnt work any ideas how to fix that??
What editor are you using? Are you sure you are actually saving the file as UTF-8? Is your server set to send .js files or your .html files as UTF-8 in the HTTP headers and not ISO-8859-1 (the default on most servers)? did you include the charset on the SCRIPT tag used to include this scripting? (assuming it's in an external file). When you said you included that 'in the head' -- in the head of what? The HTML? The HTTP headers? Though I'd suggest dropping the jquery asshattery entirely, since if the form or page is big enough or poorly labeled so much you need client side scripting that's redundant to checks you HAVE to perform server-side anyways, there's probably something wrong with the site itself.
yes i included the charset in the script and the html head: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="scripts/validation.js" charset=utf-8" ></script>
That's only half of it -- what about the HTTP headers -- is the server even configured for it? Is your editor? Generally what you set in the files is IGNORED if the server sends it in the HTTP response headers... and if your editor isn't actually saving UTF-8, then you've got real problems. Generally speaking setting it in the markup is only useful in local testing, entirely because the HTML "head" is ignored in favor of the HTTP "headers"... most servers default to ISO-8859-1, so you have to either reconfigure apache's ini files to change that, or use a htaccess file for same... or whatever the equivalent is on whatever server software you're hosted on. ALSO, does the FONT you're trying to use on the page actually support the characters you are trying to use? Fancy webfonts for example (and even many system fonts for certain OS) don't include anything more than ASCII7 and the Latin-1 set.