|
|
|
|
|
by waltman
3163 days ago
|
|
COBOL structures are better for fixed-length strings than C structs are because C really prefers strings do be null terminated. In C you've got to specify the length of each string, whereas in COBOL the compiler takes care of that for you. |
|
Now, for fun, let's poke a zero byte into that buffer:
There it is. Now decode: What's that? My UTF-8 decoder treats the 00 as an invalid byte, and maps it into the surrogate pair range U+DCXX. The otherwise optional semicolon was output because the next character in the string is a hex digit.If that U+DC00 is encoded back, it will reproduce the null byte: