mastodon.me.uk is one of the many independent Mastodon servers you can use to participate in the fediverse.
Open, user-supported, corporation-free social media for the UK.

Administered by:

Server stats:

497
active users

Why the heck did C++ deprecate codecvt? And why the heck will it remove it and all utf conversion functions in C++26? #cxx #unicode

Peter Brett

@root42 "As the Unicode standard and security experts point out, ill-formed UTF can be and has been used as an attack vector. Yet the <codecvt> facets don’t provide the safe forms of error handling as their defaults, and it is far to
hard to use them in a safe way."

1/3

@root42 "Reports from users in the field indicated repeated attempts to use this facility, as a part of the standard library bearing the most useful name suggested this should be our best practice, only to repeatedly fail for subtle reasons in our underspecification, leading to many home-grown solutions instead after much wasted time."

2/3

@root42 open-std.org/jtc1/sc22/wg21/do

I was involved in reviewing this paper and 100% agree with the decision to deprecate and remove <codecvt>. The question is not, "Why was this added?" but should be, "Why was this added in the first place?"

3/3

@krans my question is: why isn't there a safe and good replacement in the standard...?

@teisybe @root42 I don't know the current status — I'm no longer involved in standardisation.