Skip to content

Commit 00ddb10

Browse files
author
Judd
committed
select utf8 codepage on windows
1 parent b3a6018 commit 00ddb10

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

examples/command/command.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
#include <map>
2424
#include <chrono>
2525

26+
#if defined(_WIN32)
27+
#define NOMINMAX
28+
#include <windows.h>
29+
#endif
30+
2631
// command-line parameters
2732
struct whisper_params {
2833
int32_t n_threads = std::min(4, (int32_t) std::thread::hardware_concurrency());
@@ -680,6 +685,10 @@ static int process_general_transcription(struct whisper_context * ctx, audio_asy
680685
}
681686

682687
int main(int argc, char ** argv) {
688+
#if defined(_WIN32)
689+
SetConsoleOutputCP(CP_UTF8);
690+
#endif
691+
683692
whisper_params params;
684693

685694
if (whisper_params_parse(argc, argv, params) == false) {

examples/stream/stream.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
#include <fstream>
1515
#include <chrono>
1616

17+
#if defined(_WIN32)
18+
#define NOMINMAX
19+
#include <windows.h>
20+
#endif
21+
1722
// command-line parameters
1823
struct whisper_params {
1924
int32_t n_threads = std::min(4, (int32_t) std::thread::hardware_concurrency());
@@ -113,6 +118,10 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para
113118
}
114119

115120
int main(int argc, char ** argv) {
121+
#if defined(_WIN32)
122+
SetConsoleOutputCP(CP_UTF8);
123+
#endif
124+
116125
whisper_params params;
117126

118127
if (whisper_params_parse(argc, argv, params) == false) {

examples/talk-llama/talk-llama.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
#include <sstream>
1818
#include <chrono>
1919

20+
#if defined(_WIN32)
21+
#define NOMINMAX
22+
#include <windows.h>
23+
#endif
24+
2025
static std::vector<llama_token> llama_tokenize(struct llama_context * ctx, const std::string & text, bool add_bos) {
2126
const llama_model * model = llama_get_model(ctx);
2227
const llama_vocab * vocab = llama_model_get_vocab(model);
@@ -273,6 +278,10 @@ The transcript only includes text, it does not include markup like HTML and Mark
273278
{0}{4})";
274279

275280
int main(int argc, char ** argv) {
281+
#if defined(_WIN32)
282+
SetConsoleOutputCP(CP_UTF8);
283+
#endif
284+
276285
whisper_params params;
277286

278287
if (whisper_params_parse(argc, argv, params) == false) {

0 commit comments

Comments
 (0)