How do I remove accentuated characters from a string? Especially in IE6, I had something like this:
accentsTidy = function(s){
var r=s.toLowerCase();
$scope.legal_name = $sanitize($scope.legal_name);
console.log("Name before function...",$scope.legal_name);
var str = "";
for(var i=0; i < $scope.legal_name.length; i++) {
var charName = $scope.legal_name.charAt(i);
if((charName == '&') && ($scope.legal_name.charAt(i + 1) == '#')){
var count = 0;
var subString = "";
while(true) {
if(($scope.legal_name.charCodeAt(i + 2 + count) > 47) && ($scope.legal_name.charCodeAt(i + 1 + count) < 58 )) {
subString = subString + $scope.legal_name.charAt(i + 2 + count);
count++;
} else {
if(subString.length > 0) {
var value = parseInt(subString);
str = str + String.fromCharCode(value);
i = i + 1 + count;
break;
}
}
}
} else {
str = str + charName;
}
}
$scope.legal_name = str;
console.log("Name After function...",str);