function remove_non_ascii(str) {

    if ((str === null) || (str === ''))
        return false;
    else
        str = str.toString();

    var unwanted_char_removed_str = str.replace(/[^\x20-\x7E]/g, '');
    
    unwanted_char_removed_str = scriptTagRemove(unwanted_char_removed_str);
    var dir_folder = "";
    if(ENVIROMENT == 3){
        dir_folder = "rtgv4/";
    }
//https://identityiq.com/CreditReportContent/DEFAULT/style.DEFAULT.css
    unwanted_char_removed_str = unwanted_char_removed_str.replace('href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"', 'href="/'+dir_folder+'css/font-awesome.min.css"')
    unwanted_char_removed_str = unwanted_char_removed_str.replace('href="https://www.identityiq.com/CreditReportContent/DEFAULT/style.DEFAULT.css"', 'href="/'+dir_folder+'epicvelocity/css/style.DEFAULT.css"')
    unwanted_char_removed_str = unwanted_char_removed_str.replace('href="https://identityiq.com/CreditReportContent/DEFAULT/style.DEFAULT.css"', 'href="/'+dir_folder+'epicvelocity/css/style.DEFAULT.css"')
    unwanted_char_removed_str = unwanted_char_removed_str.replace('href="https://member.identityiq.com/CreditReportContent/DEFAULT/style.DEFAULT.css"', 'href="/'+dir_folder+'epicvelocity/css/style.DEFAULT.css"')
    unwanted_char_removed_str = unwanted_char_removed_str.replace('href="https://www.identityiq.com/css/CRDownload.css"', 'href="/'+dir_folder+'epicvelocity/css/CRDownload.css"')
    unwanted_char_removed_str = unwanted_char_removed_str.replace('href="https://identityiq.com/css/CRDownload.css"', 'href="/'+dir_folder+'epicvelocity/css/CRDownload.css"')
    unwanted_char_removed_str = unwanted_char_removed_str.replace('href="https://member.identityiq.com/css/CRDownload.css"', 'href="/'+dir_folder+'epicvelocity/css/CRDownload.css"')
    unwanted_char_removed_str = replaceAllLink(unwanted_char_removed_str,'https://www.identityiq.com/images/tu/info_icon.gif','/'+dir_folder+'images/iq_report_img/info_icon.gif')//unwanted_char_removed_str.replace(, )
    unwanted_char_removed_str = replaceAllLink(unwanted_char_removed_str,'https://identityiq.com/images/tu/info_icon.gif','/'+dir_folder+'images/iq_report_img/info_icon.gif')//unwanted_char_removed_str.replace(, )
    unwanted_char_removed_str = replaceAllLink(unwanted_char_removed_str,'https://member.identityiq.com/images/tu/info_icon.gif','/'+dir_folder+'images/iq_report_img/info_icon.gif')//unwanted_char_removed_str.replace(, )
    unwanted_char_removed_str = replaceAllLink(unwanted_char_removed_str,'https://member.identityiq.com/images/tu/legend-icon.gif','/'+dir_folder+'images/iq_report_img/legend-icon.gif')//unwanted_char_removed_str.replace(, )
    unwanted_char_removed_str = replaceAllLink(unwanted_char_removed_str,'https://www.identityiq.com/images/tu/legend-icon.gif','/'+dir_folder+'images/iq_report_img/legend-icon.gif')//unwanted_char_removed_str.replace(, )
    unwanted_char_removed_str = replaceAllLink(unwanted_char_removed_str,'https://identityiq.com/images/tu/legend-icon.gif','/'+dir_folder+'images/iq_report_img/legend-icon.gif')//unwanted_char_removed_str.replace(, )
    
    return unwanted_char_removed_str;
    
}
function replaceAllLink(str, find, replace) {
    return str.replace(new RegExp(find, 'g'), replace);
}

function replaceAllString(str, find, replace) {
    return str.replace(new RegExp(find, 'g'), replace);
}
function scriptTagRemove(unwanted_char_removed_str){
    if(unwanted_char_removed_str){
        var script_tag_regex = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi
        unwanted_char_removed_str = unwanted_char_removed_str.replace(script_tag_regex, "");
    }
    
    return unwanted_char_removed_str;
}
