Verify that CSV input is encoded as UTF-8

This commit is contained in:
Eric Fischer
2017-12-06 13:32:44 -08:00
parent f3e6afa4e9
commit afb5cece96
4 changed files with 39 additions and 1 deletions
+13
View File
@@ -9,6 +9,7 @@
#include <vector>
#include "jsonpull/jsonpull.h"
#include "csv.hpp"
#include "text.hpp"
int fail = EXIT_SUCCESS;
bool wrap = false;
@@ -208,6 +209,12 @@ void join_csv(json_object *j) {
exit(EXIT_FAILURE);
}
std::string err = check_utf8(s);
if (err != "") {
fprintf(stderr, "%s\n", err.c_str());
exit(EXIT_FAILURE);
}
header = csv_split(s.c_str());
for (size_t i = 0; i < header.size(); i++) {
@@ -264,6 +271,12 @@ void join_csv(json_object *j) {
break;
}
std::string err = check_utf8(s);
if (err != "") {
fprintf(stderr, "%s\n", err.c_str());
exit(EXIT_FAILURE);
}
fields = csv_split(s.c_str());
for (size_t i = 0; i < fields.size(); i++) {