mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
Update csv.cpp
This commit is contained in:
parent
f1ff2639af
commit
657062d25a
@ -11,6 +11,10 @@ void add_module_csv(VM *vm){
|
|||||||
List ret;
|
List ret;
|
||||||
for(int i=0; i<csvfile.size(); i++){
|
for(int i=0; i<csvfile.size(); i++){
|
||||||
std::string_view line = CAST(Str&, csvfile[i]).sv();
|
std::string_view line = CAST(Str&, csvfile[i]).sv();
|
||||||
|
if(i == 0){
|
||||||
|
// Skip utf8 BOM if there is any.
|
||||||
|
if (strncmp(line.data(), "\xEF\xBB\xBF", 3) == 0) line = line.substr(3);
|
||||||
|
}
|
||||||
List row;
|
List row;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
bool in_quote = false;
|
bool in_quote = false;
|
||||||
@ -37,6 +41,8 @@ void add_module_csv(VM *vm){
|
|||||||
buffer.clear();
|
buffer.clear();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case '\r':
|
||||||
|
break; // ignore
|
||||||
default:
|
default:
|
||||||
buffer += line[j];
|
buffer += line[j];
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user