From ea59e63134e454fbef2824ba25f988e1c9b33fab Mon Sep 17 00:00:00 2001 From: Tiago Macarios Date: Tue, 15 Sep 2026 08:58:53 -0700 Subject: [PATCH 1/2] Use classic grouping without locale support Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- include/fmt/format-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 740ec21b0a24..6ed620c8ac0a 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -64,7 +64,7 @@ using std::use_facet; namespace detail { struct locale {}; template struct numpunct { - auto grouping() const -> std::string { return "\03"; } + auto grouping() const -> std::string { return {}; } auto thousands_sep() const -> Char { return ','; } auto decimal_point() const -> Char { return '.'; } }; From a6aaa424b6521a8b86b5fd68d6edce194c8c3416 Mon Sep 17 00:00:00 2001 From: Tiago Macarios Date: Tue, 15 Sep 2026 08:59:23 -0700 Subject: [PATCH 2/2] Test localized formatting without locale support Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- test/CMakeLists.txt | 3 ++- test/nolocale-test.cc | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/nolocale-test.cc diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 48c5f93a1e71..1cd0f5ee4ce7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -129,12 +129,13 @@ if (FMT_PEDANTIC) endif () # Test that the library compiles without locale. - add_library(nolocale-test ../src/format.cc) + add_executable(nolocale-test ../src/format.cc nolocale-test.cc) target_include_directories(nolocale-test PRIVATE ${PROJECT_SOURCE_DIR}/include) target_compile_definitions(nolocale-test PRIVATE FMT_USE_LOCALE=0) target_compile_options(nolocale-test PRIVATE $<$:/utf-8>) + add_test(NAME nolocale-test COMMAND nolocale-test) endif () # These tests are disabled on Windows because they take too long. diff --git a/test/nolocale-test.cc b/test/nolocale-test.cc new file mode 100644 index 000000000000..17cf1ed13b30 --- /dev/null +++ b/test/nolocale-test.cc @@ -0,0 +1,13 @@ +// Formatting library for C++ - no-locale tests +// +// Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors +// All rights reserved. +// +// For the license information refer to format.h. + +#include "fmt/format.h" + +int main() { + if (fmt::format("{:L}", 1234567) != "1234567") return 1; + if (fmt::format("{:L}", 1234.5) != "1234.5") return 1; +}