JuliaLang/julia — comment on commit 1352a7d8e5cb3fd06aa94a26c086744e1c50df41
File: j/string.j line 167
By StefanKarpinski:

Good to know. For compatibility in printf and efficiency we may want to treat the width of any pure ascii string as its string length. For example, consider this test program:

```
#include
int main(int argc, char **argv) {
printf(argv[1], argv[2]);
printf("\n");
}
```

and the following output:

```
$ ./test "|%10s|" $(printf "fooxbar")
| fooxbar|
$ ./test "|%10s|" $(printf "foo\1bar")
| foobar|
```

Since `'\1'` is non-printing, that's kind of ok — we can just count non-printing characters as width one. Or maybe just non-printing ASCII characters? The`'\0'` character is a different story: that's technically zero-width, not non-printing, but terminates strings for C's printf:

```
$ ./test "|%10s|" $(printf "foo\0bar")
| foo|
```

I'm not sure if we want to emulate that behavior or allow embedding `'\0'` characters in printf since we don't delimit the ends of strings that way.