
19 Jan
2011
19 Jan
'11
10:07 p.m.
Dave Abrahams wrote:
At Wed, 19 Jan 2011 23:02:02 +0200, Peter Dimov wrote:
My answer is different. T is std::string, and:
- on POSIX OSes, this string is taken directly from the OS and given directly to the OS, without any conversion;
- on Windows, this string is UTF-8 and is converted to UTF-16 before being given to the OS, and converted from UTF-16 after being received from it. This conversion should tolerate broken UTF-16 because the OS does so as well.
...
I prefer to have semantic constraints/invariants like "this is UTF-8 encoded" represented in the type system and enforced by public library interfaces. I'm arguing for a future like that.
But the semantics I outlined above only have this constraint under Windows.