got the answer on my own, the files were getting saved just right, the problem was that my server didn't have utf-8 so it was showing me these characters, and as for having to limit the user to only use english and persian alphabet and number I came up with this solution:
$('input').keypress(function( e ) {
if(!/([ابپتثجچحخدذرزژشسصضطظعغفقکگلمنوهیء a-zA-Z0-9])+/.test(String.fromCharCode(e.which)))
return false;
});