From 8d9d5693e7635a81196368e7708ac3718a36059f Mon Sep 17 00:00:00 2001 From: axxel Date: Tue, 3 Sep 2024 00:09:14 +0200 Subject: [PATCH] WriteBarcode: generate UTF8 with MultiFormatWriter backend of exp. API See also #819. --- core/src/WriteBarcode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/WriteBarcode.cpp b/core/src/WriteBarcode.cpp index edbca52994..e39f4412d3 100644 --- a/core/src/WriteBarcode.cpp +++ b/core/src/WriteBarcode.cpp @@ -350,6 +350,7 @@ Barcode CreateBarcodeFromText(std::string_view contents, const CreatorOptions& o auto writer = MultiFormatWriter(opts.format()).setMargin(0); if (!opts.ecLevel().empty()) writer.setEccLevel(std::stoi(opts.ecLevel())); + writer.setEncoding(CharacterSet::UTF8); // write UTF8 (ECI value 26) for maximum compatibility return CreateBarcode(writer.encode(std::string(contents), 0, IsLinearCode(opts.format()) ? 50 : 0), opts); }