Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
1f329990
Commit
1f329990
authored
17 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
On OS X, assume that an empty-string result for nl_langinfo(CODESET)
means UTF-8. Per examination of /usr/share/locale in 10.4.10.
parent
304750f8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/port/chklocale.c
+18
-1
18 additions, 1 deletion
src/port/chklocale.c
with
18 additions
and
1 deletion
src/port/chklocale.c
+
18
−
1
View file @
1f329990
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/chklocale.c,v 1.
1
2007/09/28 2
2:25:49
tgl Exp $
* $PostgreSQL: pgsql/src/port/chklocale.c,v 1.
2
2007/09/28 2
3:36:06
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -158,6 +158,7 @@ pg_get_encoding_from_locale(const char *ctype)
char
*
sys
;
int
i
;
/* Get the CODESET property, and also LC_CTYPE if not passed in */
if
(
ctype
)
{
char
*
save
;
...
...
@@ -197,12 +198,14 @@ pg_get_encoding_from_locale(const char *ctype)
if
(
!
sys
)
return
PG_SQL_ASCII
;
/* out of memory; unlikely */
/* If locale is C or POSIX, we can allow all encodings */
if
(
pg_strcasecmp
(
ctype
,
"C"
)
==
0
||
pg_strcasecmp
(
ctype
,
"POSIX"
)
==
0
)
{
free
(
sys
);
return
PG_SQL_ASCII
;
}
/* Check the table */
for
(
i
=
0
;
encoding_match_list
[
i
].
system_enc_name
;
i
++
)
{
if
(
pg_strcasecmp
(
sys
,
encoding_match_list
[
i
].
system_enc_name
)
==
0
)
...
...
@@ -212,6 +215,20 @@ pg_get_encoding_from_locale(const char *ctype)
}
}
/* Special-case kluges for particular platforms go here */
#ifdef __darwin__
/*
* Current OS X has many locales that report an empty string for CODESET,
* but they all seem to actually use UTF-8.
*/
if
(
strlen
(
sys
)
==
0
)
{
free
(
sys
);
return
PG_UTF8
;
}
#endif
/*
* We print a warning if we got a CODESET string but couldn't recognize
* it. This means we need another entry in the table.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment