Hey folks!
Also, having '\x5c' included in the UB is presumably unintended. The user intent is expressed by the numeric escape. Furthermore, consideration should be given (and documented) about whether the UB should apply to "unparsed" strings (like the argument given to printf for %s) for "locale sensitive" functions. Again though, I think that we're really talking about there being "natural consequences" of defined behaviour when "bad input" is involved.
Are you saying that Undefined Behavior would be too big of a hammer?
The way I see it, mojibake is not something that should happen in a well-behaved program, aka it is a precondition violation of locale-specific functions.
And I think not having that precondition stated makes it harder to specify the behavior of std::print for example.
My intent is to say " The standard assumes that all strings are interpreted by local specific functions as being encoded by the execution encoding and if that's not the case, you will get mojibake or any other behavior that may be the result of your input not being interpreted correctly"