News for hackers. Stuff that matters.
Re:Curl doesn’t spew binary anymore by mikeash on Saturday June 17, 2017 @11:06AM (#14576186)
It's worth noting that, while NUL is valid UTF-8, there's a lot of software which will fail strangely when presented with it, since UTF-8 is so often used to interoperate with NUL-terminated C strings. If you write such a string to a C string then it will be silently truncated.

I ran into this once with an Objective-C program that created filenames from strings found in files. When presented with a string containing NUL, the code ran, but didn't really work. I'd get "foo" and then ask it to append ".txt" and the result would come back as "foo" still! And it depends on the context in which you use it. Using it as a filename truncated, because you ultimately go through the POSIX-level calls that use C strings. Printing it in the debugger truncated, as evidently it used C strings at some point in that process. Displaying it in a text field in the UI worked perfectly fine, though, as apparently that path never uses C strings and the NUL character is just an invisible zero-space character in the middle.

Re:Curl doesn’t spew binary anymore by girvo on Saturday June 17, 2017 @09:33PM (#14578532)
I ran into this when writing a Docker API client in Nim via its Unix socket! Was very confused until I remembered that.