Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra characters printed when formatting invalid UTF-8 with precision #3284

Closed
lriesterer opened this issue Jan 23, 2023 · 1 comment
Closed

Comments

@lriesterer
Copy link

Formatting using string precision fails when there are non-ascii characters.

Here is a code to reproduce (first line works as expected, second doesn't as there is an extra "diamond-shaped" character printed):

#include <fmt/format.h>
int main()
{
    fmt::print(">>{:.6}<<\n", "1234567");
    fmt::print(">>{:.6}<<\n", "123456\xad");
    return 0;
}

https://godbolt.org/z/zzY4Y4Pec

@vitaut vitaut changed the title Extra characters printed when formatting a string with precision Extra characters printed when formatting invalid UTF-8 with precision Mar 4, 2023
@vitaut
Copy link
Contributor

vitaut commented Nov 18, 2023

Fixed in c13753a. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants