将文件导出为CSV将单元格与空格合并

<script>function doCSV() {
    var table = document.getElementById("player_info").innerHTML;
    var data = table.replace(/<thead>/g, '')
        .replace(/<\/thead>/g, '')
        .replace(/<tbody>/g, '')
        .replace(/<\/tbody>/g, '')
        .replace(/<tr>/g, '')
        .replace(/<\/tr>/g, '
')
        .replace(/<th>/g, '')
        .replace(/<\/th>/g, ',')
        .replace(/<td>/g, '')
        .replace(/<\/td>/g, ',')
        .replace(/\t/g, '')
        .replace(/
/g, '');
    var mylink = document.createElement('a');
    mylink.download = "fplinfo.csv";
    mylink.href = "data:application/csv," + escape(data);
    mylink.click();
}</script>

I have this sitewhere I can fetch the data from fpl site.

I can export the file form web in csv file, but the problem is

if the web name or Full name have some other character text like Mesut Özil Ö , those particular rows merges up the cell if there is any spaces
in the table. Rest of the rows are fine.

I have looked up the proble, but I cannot understand, whats wrong, because rest of them are working normal.