1

I´m trying to get data inside a csv file using alasql http://alasql.org , but when i put a file (.csv) in a input file, and i do a select with alasql and some word contain accent i get this simbol "�" where contain accent in that word, i search and i found in github to insert utf8Bom, but don´t work yet, i´m using alasql version v0.4.5, how can i solve this problem?

jsfiddle

<html>
   <head>
       <meta charset="ISO-8859-1">
   </head>
   <body>
       <input id="readfile" type="file" onchange="loadFile(event)"/>
       <xmp id="output"></xmp>

       <script>               
            var arr = [];
            arr.length = 20000;
            console.log(arr.length);
            alert('AlaSQL v'+alasql.version)
            print('Please upload txt, json, csv, tsv, tab, xlsx, xls or html file to see the content')

            loadFile = function(event) {
                alasql('SELECT * FROM FILE(?,{headers:true, utf8bom: true, 
                separator:";" })',[event],function(data){  
                    print(data)
                });
            }

            function print(x){
                document.getElementById('output').textContent +=JSON.stringify(x, null, '\t') + "\n";   
            }
      </script>
   </body>
</html>
Jghorton14
  • 724
  • 1
  • 8
  • 25
Fernando josé
  • 249
  • 4
  • 10

0 Answers0