In my C++17 project, I have a std::string which is known to contain UTF-8 encoded data. Is there any way to force fmt to treat its data as UTF-8 such that this works as expected?
fmt::print("{:-^11}", "あいう");
// should print "----あいう----", currently prints "-あいう-"
UTF-8 handling in {fmt} was recently improved and your example now works with the master branch:
#include <fmt/core.h>
int main() {
fmt::print("{:-^11}", "あいう");
}
prints
----あいう----
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With