Use mkpath to create parent folders if needed, prevents segfaults
Use encoding detector before loading data