utf8: portable Windows UTF-8 boundary for argv, fopen and CreateFile

This commit is contained in:
Pascal
2026-05-14 14:10:26 +02:00
parent 57d12ba4e5
commit eb48f33f09
8 changed files with 119 additions and 14 deletions
+3 -1
View File
@@ -14,6 +14,7 @@
#include "backend.h"
#include "bpe.h"
#include "pipeline-tts.h"
#include "utf8.h"
#include "version.h"
#include <cstdio>
@@ -104,7 +105,7 @@ static std::string read_stdin_text() {
// Read a small text file into a string. Trims trailing newlines.
static bool read_text_file(const char * path, std::string & out) {
FILE * f = fopen(path, "rb");
FILE * f = utf8_fopen(path, "rb");
if (!f) {
fprintf(stderr, "[CLI] FATAL: cannot open '%s'\n", path);
return false;
@@ -400,6 +401,7 @@ static int run(const Args & a) {
}
int main(int argc, char ** argv) {
utf8_init(&argc, &argv);
Args a;
if (!parse_args(argc, argv, a)) {
print_usage(argv[0]);