Download BLOB content using specified charset

后端 未结 4 2158
谎友^
谎友^ 2020-12-13 18:00

Is possible to change the Blob charset really? I\'m trying it for hours but it doesn\'t workds. See this.

jQuery(\"#download\").click(function() {
    var cs         


        
4条回答
  •  臣服心动
    2020-12-13 18:48

    If you have some symbols in the csv and the accepted solution is not solving the problem:

    blob = new Blob(["\ufeff", csv_content]);
    // for csv_content you can try like below.
    function b64DecodeUnicode(str: any) {        
            return decodeURIComponent(atob(str).split('').map((c: any) => {
                return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
            }).join(''));
        }
    

提交回复
热议问题