set encoding for to UTF-8 for csv parser

This commit is contained in:
Kyle Spearrin 2016-10-17 23:00:44 -04:00
parent 4c0bde9d87
commit 52b3dfd0e3
1 changed files with 13 additions and 3 deletions

View File

@ -44,6 +44,7 @@
function importLocal(file, success, error) { function importLocal(file, success, error) {
Papa.parse(file, { Papa.parse(file, {
header: true, header: true,
encoding: 'UTF-8',
complete: function (results) { complete: function (results) {
var folders = [], var folders = [],
sites = [], sites = [],
@ -105,16 +106,22 @@
if (pre.length === 1) { if (pre.length === 1) {
csv = pre.text().trim(); csv = pre.text().trim();
results = Papa.parse(csv, { header: true }); results = Papa.parse(csv, {
header: true,
encoding: 'UTF-8'
});
parseData(results.data); parseData(results.data);
} }
else { else {
var foundPre = false; var foundPre = false;
for (var i = 0; i < doc.length; i++) { for (var i = 0; i < doc.length; i++) {
if (doc[i].tagName === 'PRE') { if (doc[i].tagName.toLowerCase() === 'pre') {
foundPre = true; foundPre = true;
csv = doc[i].outerText.trim(); csv = doc[i].outerText.trim();
results = Papa.parse(csv, { header: true }); results = Papa.parse(csv, {
header: true,
encoding: 'UTF-8'
});
parseData(results.data); parseData(results.data);
break; break;
} }
@ -133,6 +140,7 @@
else { else {
Papa.parse(file, { Papa.parse(file, {
header: true, header: true,
encoding: 'UTF-8',
complete: function (results) { complete: function (results) {
parseData(results.data); parseData(results.data);
} }
@ -191,6 +199,7 @@
function importSafeInCloudCsv(file, success, error) { function importSafeInCloudCsv(file, success, error) {
Papa.parse(file, { Papa.parse(file, {
header: true, header: true,
encoding: 'UTF-8',
complete: function (results) { complete: function (results) {
var folders = [], var folders = [],
sites = [], sites = [],
@ -310,6 +319,7 @@
function importPadlockCsv(file, success, error) { function importPadlockCsv(file, success, error) {
Papa.parse(file, { Papa.parse(file, {
encoding: 'UTF-8',
complete: function (results) { complete: function (results) {
var folders = [], var folders = [],
sites = [], sites = [],