#4961·fmt

Characters added after Unicode 13.0 are escaped as unprintable

Author: FenjuFuCreated Sep 30, 2026Updated Sep 30, 2026
Labelsenhancement

fmt::detail::is_printable was generated by support/printable.py in 2021 from Unicode 13.0 data and hasn't been regenerated since. As a result, the 15,942 code points assigned in Unicode 14.0 through 17.0 are treated as unassigned (Cn) and get escaped by the debug presentation ({:?}) and by range/tuple formatting, which is not what [format.string.escaped] asks for.

This affects, among others:

  • common emoji such as U+1FAE0 MELTING FACE (Unicode 14.0)
  • 9,140 CJK Unified Ideographs, e.g. U+31350 from Extension H (Unicode 15.0), which are used in personal and place names
cpp
#include <fmt/ranges.h>
#include <string>
#include <vector>

int main() {
  fmt::print("{}\n", std::vector<std::string>{"", "\U00031350"});
  fmt::print("{:?}\n", "");
}

Output on current main:

["\U0001fae0", "\U00031350"]
"\U0001fae0"

Expected:

["", ""]
""

Note that test/ranges-test.cc currently uses U+2A6DE as an example of an unassigned code point, but it has been assigned since Unicode 14.0.

Rerunning support/printable.py against the current UnicodeData.txt fixes this.