Re: [GENERAL] psql weird behaviour with charset encodings
| От | hgonzalez@gmail.com |
|---|---|
| Тема | Re: [GENERAL] psql weird behaviour with charset encodings |
| Дата | |
| Msg-id | 0016362842accfef6204860b60f4@google.com обсуждение исходный текст |
| Ответ на | Re: [GENERAL] psql weird behaviour with charset encodings (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: [GENERAL] psql weird behaviour with charset encodings
|
| Список | pgsql-hackers |
> However, it appears that glibc's printf
code interprets the parameter as the number of *characters* to print,
and to determine what's a character it assumes the string is in the
environment LC_CTYPE's encoding.
Well, I myself have problems to believe that :-)
This would be nasty... Are you sure?
I couldn reproduce that.
I made a quick test, passing a utf-8 encoded string
(5 bytes correspoding to 4 unicode chars: "niño")
And my glib (same Fedora 12) seems to count bytes,
as it should.
#include<stdio.h>
main () {
char s[] = "ni\xc3\xb1o";
printf("|%.*s|\n",5,s);
}
This, compiled with gcc 4.4.3, run with my root locale (utf8)
did not padded a blank. i.e. it worked as expected.
Hernán
code interprets the parameter as the number of *characters* to print,
and to determine what's a character it assumes the string is in the
environment LC_CTYPE's encoding.
Well, I myself have problems to believe that :-)
This would be nasty... Are you sure?
I couldn reproduce that.
I made a quick test, passing a utf-8 encoded string
(5 bytes correspoding to 4 unicode chars: "niño")
And my glib (same Fedora 12) seems to count bytes,
as it should.
#include<stdio.h>
main () {
char s[] = "ni\xc3\xb1o";
printf("|%.*s|\n",5,s);
}
This, compiled with gcc 4.4.3, run with my root locale (utf8)
did not padded a blank. i.e. it worked as expected.
Hernán
В списке pgsql-hackers по дате отправления: