4 ms·
> Old code that passes the string to a strcat() will fail in mysterious ways. And your old libraries probably expect 1-byte characters anyway, which means you'r
by lucumo 17y ago
> Old code that passes the string to a strcat() will fail in mysterious ways. And your old libraries probably expect 1-byte characters anyway, which means you're going to be constantly converting
But they will have that same problem with UTF-8, right? Just as soon as you start using non-Latin characters? And if you aren't, there's no point in going beyond ASCII.
- ajross 17y agoUh, no, not at all. The ANSI strXXX() functions work just fine with UTF-8, that was kind of the point. Anything treating strings with nul termination or counted byte length works without change. Any work involving only ASCII substrings (e.g. parsing of computer-readable data) works without change. No non-ASCII character is represented using ASCII bytes in the string. Everything Just Works. Which is why you should just use it. The sole exception are algorithms that truly need random access to characters within the string (e.g. "give me the 32nd character"), which can't interoperate with any variable-length encoding. But there are precious few of these. All anyone cares about is substrings.