hernan gonzalez <hgonzalez@gmail.com> writes:
> Sorry about a error in my previous example (mixed width and precision).
> But the conclusion is the same - it works on bytes:
This example works like that because it's running in C locale always.
Try something like this:
#include<stdio.h>
#include<locale.h>
int main () {
char s[] = "ni\xc3qo"; /* 5 bytes , not valid utf8 */
setlocale(LC_ALL, "");
printf("|%.*s|\n",3,s);
return 0;
}
I get different (and undesirable) effects depending on LANG.
regards, tom lane