Re: setlocale
От | Peter Eisentraut |
---|---|
Тема | Re: setlocale |
Дата | |
Msg-id | Pine.LNX.4.44.0310081929570.26413-100000@peter.localdomain обсуждение исходный текст |
Ответ на | setlocale (Andrew Dunstan <andrew@dunslane.net>) |
Список | pgsql-hackers |
Andrew Dunstan writes: > At program startup, the equivalent of the following statement is executed: > setlocale( LC_ALL, "C" ); > Does this have any effect on us? No, that is just a peculiar way to express that by default nothing happens. > Does it mean, as it appears to, that the locale will not be inherited > from the parent? A process never inherits the locale from the parent. It only inherits environment variables, among which may be LC_ALL, etc. To activate any kind of locale in a program you need to call setlocale(LC_xxx, "something"); where "something" may be the name of the actual locale you want, or -- as a special case -- it may be "", in which case it takes the value of the respective environment variable LC_xxx. There is an appearance of inheritance in shell scripts, but only because the shell takes care of some of these things automatically. > If so, I guess it could be got around by passing LC_COLLATE and LC_CTYPE > arguments to postgres when running the bootstrap code. The easiest solution would be to stick LC_COLLATE and LC_CTYPE into the environment of the postgres process when you call it the first time (in bootstrap mode). If no --lc-* options were given, you don't need to do anything, because "postgres" will just take what's in the environment. If --lc-* options where given, you could use putenv(). > Another question - will we want to internationalize initdb Yes, but that should really wait until we have a working C version first. -- Peter Eisentraut peter_e@gmx.net
В списке pgsql-hackers по дате отправления: