|
@@ -1,6 +1,5 @@
|
|
|
import {ElMessage} from "element-plus";
|
|
|
-// const iconv = require('iconv-lite')
|
|
|
-import {decode,encode} from 'iconv-lite'
|
|
|
+import {encode} from 'iconv-lite'
|
|
|
|
|
|
export function exportCSV(data, field, fileName) {
|
|
|
if (!data || data.length === 0) {
|
|
@@ -49,33 +48,4 @@ function trim(str, char) {
|
|
|
str = str.replace(new RegExp('^\\' + char + '+|\\' + char + '+$', 'g'), '')
|
|
|
}
|
|
|
return str.replace(/^\s + |\s + $/g, '')
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-function utf8ToUnicode(utf8) {
|
|
|
- // 将UTF-8格式的字节转成Unicode字符串
|
|
|
- var unicode = "";
|
|
|
- var i = 0;
|
|
|
- while (i < utf8.length) {
|
|
|
- var c = utf8.charCodeAt(i);
|
|
|
- if (c < 128) {
|
|
|
- unicode += String.fromCharCode(c);
|
|
|
- i++;
|
|
|
- } else if ((c > 191) && (c < 224)) {
|
|
|
- unicode += String.fromCharCode(((c & 0x1f) << 6) | (utf8.charCodeAt(i + 1) & 0x3f));
|
|
|
- i += 2;
|
|
|
- } else {
|
|
|
- unicode += String.fromCharCode(((c & 0x0f) << 12) | ((utf8.charCodeAt(i + 1) & 0x3f) << 6) | (utf8.charCodeAt(i + 2) & 0x3f));
|
|
|
- i += 3;
|
|
|
- }
|
|
|
- }
|
|
|
- return unicode;
|
|
|
-}
|
|
|
-
|
|
|
-function unicodeToGbk(str){
|
|
|
- var arr = [];
|
|
|
- for(var i=0; i<str.length; i++){
|
|
|
- arr.push('\\u' + str.charCodeAt(i).toString(16));
|
|
|
- }
|
|
|
- return unescape(arr.join('').replace(/\\/g, '%'));
|
|
|
}
|