[PATCH 3/6] psql: Create table format
От | Roger Leigh |
---|---|
Тема | [PATCH 3/6] psql: Create table format |
Дата | |
Msg-id | 1250956790-18404-4-git-send-email-rleigh@debian.org обсуждение исходный текст |
Ответ на | [PATCH 1/6] psql: Abstract table formatting characters used for different line types. (Roger Leigh <rleigh@debian.org>) |
Список | pgsql-hackers |
Default to using the ASCII table. However, if a UTF-8 locale codeset is in use, switch to the UTF-8 table. Signed-off-by: Roger Leigh <rleigh@debian.org> ---src/bin/psql/print.c | 11 ++++++++++-1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 9dec77d..6f5dcd4 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -21,6 +21,9 @@#endif#include <locale.h> +#ifdef HAVE_LANGINFO_H +#include <langinfo.h> +#endif#include "catalog/pg_type.h"#include "pqsignal.h" @@ -2232,7 +2235,13 @@ IsPagerNeeded(const printTableContent *cont, const int extra_lines, FILE **fout,voidprintTable(constprintTableContent *cont, FILE *fout, FILE *flog){ - bool is_pager = false; + bool is_pager = false; + const printTextFormat *text_format = &asciiformat; + +#if (defined(HAVE_LANGINFO_H) && defined(CODESET)) + if (!strcmp(nl_langinfo(CODESET), "UTF-8")) + text_format = &utf8format; +#endif if (cancel_pressed) return; -- 1.6.3.3
В списке pgsql-hackers по дате отправления: