Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit64e1309

Browse files
committed
Consistently quote encoding and locale names in messages
1 parent7167fcd commit64e1309

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

‎src/backend/commands/dbcommands.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,12 @@ createdb(const CreatedbStmt *stmt)
323323
if (!check_locale(LC_COLLATE,dbcollate,&canonname))
324324
ereport(ERROR,
325325
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
326-
errmsg("invalid locale name %s",dbcollate)));
326+
errmsg("invalid locale name: \"%s\"",dbcollate)));
327327
dbcollate=canonname;
328328
if (!check_locale(LC_CTYPE,dbctype,&canonname))
329329
ereport(ERROR,
330330
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
331-
errmsg("invalid locale name %s",dbctype)));
331+
errmsg("invalid locale name: \"%s\"",dbctype)));
332332
dbctype=canonname;
333333

334334
check_encoding_locale_matches(encoding,dbcollate,dbctype);
@@ -692,10 +692,10 @@ check_encoding_locale_matches(int encoding, const char *collate, const char *cty
692692
(encoding==PG_SQL_ASCII&&superuser())))
693693
ereport(ERROR,
694694
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
695-
errmsg("encoding%s does not match locale%s",
695+
errmsg("encoding\"%s\" does not match locale\"%s\"",
696696
pg_encoding_to_char(encoding),
697697
ctype),
698-
errdetail("The chosen LC_CTYPE setting requires encoding%s.",
698+
errdetail("The chosen LC_CTYPE setting requires encoding\"%s\".",
699699
pg_encoding_to_char(ctype_encoding))));
700700

701701
if (!(collate_encoding==encoding||
@@ -707,10 +707,10 @@ check_encoding_locale_matches(int encoding, const char *collate, const char *cty
707707
(encoding==PG_SQL_ASCII&&superuser())))
708708
ereport(ERROR,
709709
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
710-
errmsg("encoding%s does not match locale%s",
710+
errmsg("encoding\"%s\" does not match locale\"%s\"",
711711
pg_encoding_to_char(encoding),
712712
collate),
713-
errdetail("The chosen LC_COLLATE setting requires encoding%s.",
713+
errdetail("The chosen LC_COLLATE setting requires encoding\"%s\".",
714714
pg_encoding_to_char(collate_encoding))));
715715
}
716716

‎src/bin/initdb/initdb.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ setup_collation(void)
16511651
if (len==0||localebuf[len-1]!='\n')
16521652
{
16531653
if (debug)
1654-
fprintf(stderr,_("%s: locale name too long, skipped:%s\n"),
1654+
fprintf(stderr,_("%s: locale name too long, skipped:\"%s\"\n"),
16551655
progname,localebuf);
16561656
continue;
16571657
}
@@ -1676,7 +1676,7 @@ setup_collation(void)
16761676
if (skip)
16771677
{
16781678
if (debug)
1679-
fprintf(stderr,_("%s: locale name has non-ASCII characters, skipped:%s\n"),
1679+
fprintf(stderr,_("%s: locale name has non-ASCII characters, skipped:\"%s\"\n"),
16801680
progname,localebuf);
16811681
continue;
16821682
}
@@ -2971,7 +2971,7 @@ main(int argc, char *argv[])
29712971
strcmp(lc_ctype,lc_numeric)==0&&
29722972
strcmp(lc_ctype,lc_monetary)==0&&
29732973
strcmp(lc_ctype,lc_messages)==0)
2974-
printf(_("The database cluster will be initialized with locale%s.\n"),lc_ctype);
2974+
printf(_("The database cluster will be initialized with locale\"%s\".\n"),lc_ctype);
29752975
else
29762976
{
29772977
printf(_("The database cluster will be initialized with locales\n"
@@ -2998,7 +2998,7 @@ main(int argc, char *argv[])
29982998
if (ctype_enc==-1)
29992999
{
30003000
/* Couldn't recognize the locale's codeset */
3001-
fprintf(stderr,_("%s: could not find suitable encoding for locale%s\n"),
3001+
fprintf(stderr,_("%s: could not find suitable encoding for locale\"%s\"\n"),
30023002
progname,lc_ctype);
30033003
fprintf(stderr,_("Rerun %s with the -E option.\n"),progname);
30043004
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),
@@ -3013,18 +3013,18 @@ main(int argc, char *argv[])
30133013
* UTF-8.
30143014
*/
30153015
#ifdefWIN32
3016-
printf(_("Encoding%s implied by locale is not allowed as a server-side encoding.\n"
3017-
"The default database encoding will be set to%s instead.\n"),
3016+
printf(_("Encoding\"%s\" implied by locale is not allowed as a server-side encoding.\n"
3017+
"The default database encoding will be set to\"%s\" instead.\n"),
30183018
pg_encoding_to_char(ctype_enc),
30193019
pg_encoding_to_char(PG_UTF8));
30203020
ctype_enc=PG_UTF8;
30213021
encodingid=encodingid_to_string(ctype_enc);
30223022
#else
30233023
fprintf(stderr,
3024-
_("%s: locale%s requires unsupported encoding%s\n"),
3024+
_("%s: locale\"%s\" requires unsupported encoding\"%s\"\n"),
30253025
progname,lc_ctype,pg_encoding_to_char(ctype_enc));
30263026
fprintf(stderr,
3027-
_("Encoding%s is not allowed as a server-side encoding.\n"
3027+
_("Encoding\"%s\" is not allowed as a server-side encoding.\n"
30283028
"Rerun %s with a different locale selection.\n"),
30293029
pg_encoding_to_char(ctype_enc),progname);
30303030
exit(1);
@@ -3033,7 +3033,7 @@ main(int argc, char *argv[])
30333033
else
30343034
{
30353035
encodingid=encodingid_to_string(ctype_enc);
3036-
printf(_("The default database encoding has accordingly been set to%s.\n"),
3036+
printf(_("The default database encoding has accordingly been set to\"%s\".\n"),
30373037
pg_encoding_to_char(ctype_enc));
30383038
}
30393039
}
@@ -3050,7 +3050,7 @@ main(int argc, char *argv[])
30503050
default_text_search_config=find_matching_ts_config(lc_ctype);
30513051
if (default_text_search_config==NULL)
30523052
{
3053-
printf(_("%s: could not find suitable text search configuration for locale%s\n"),
3053+
printf(_("%s: could not find suitable text search configuration for locale\"%s\"\n"),
30543054
progname,lc_ctype);
30553055
default_text_search_config="simple";
30563056
}
@@ -3061,12 +3061,12 @@ main(int argc, char *argv[])
30613061

30623062
if (checkmatch==NULL)
30633063
{
3064-
printf(_("%s: warning: suitable text search configuration for locale%s is unknown\n"),
3064+
printf(_("%s: warning: suitable text search configuration for locale\"%s\" is unknown\n"),
30653065
progname,lc_ctype);
30663066
}
30673067
elseif (strcmp(checkmatch,default_text_search_config)!=0)
30683068
{
3069-
printf(_("%s: warning: specified text search configuration \"%s\" might not match locale%s\n"),
3069+
printf(_("%s: warning: specified text search configuration \"%s\" might not match locale\"%s\"\n"),
30703070
progname,default_text_search_config,lc_ctype);
30713071
}
30723072
}

‎src/test/locale/test-ctype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ main()
6464

6565
cur_locale=setlocale(LC_ALL,"");
6666
if (cur_locale)
67-
fprintf(stderr,"Successfulle set locale to%s\n",cur_locale);
67+
fprintf(stderr,"Successfully set locale to\"%s\"\n",cur_locale);
6868
else
6969
{
7070
fprintf(stderr,"Cannot setup locale. Either your libc does not provide\nlocale support, or your locale data is corrupt, or you have not set\nLANG or LC_CTYPE environment variable to proper value. Program aborted.\n");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp