Skip to content

Commit

Permalink
Use Win32 Unicode APIs and expect all strings to be UTF-8 (fixes OSGe…
Browse files Browse the repository at this point in the history
…o#1765)

For backward compatibility, if PROJ_LIB content is found to be not UTF-8 or
pointing to a non existing directory, then an attempt at interpretating it
in the ANSI page encoding is done.

proj_context_set_search_paths() now assumes strings to be in UTF-8, and
functions returning paths will also return values in UTF-8.
  • Loading branch information
rouault committed Jan 10, 2020
1 parent 90b6685 commit 8d8566c
Show file tree
Hide file tree
Showing 7 changed files with 874 additions and 654 deletions.
7 changes: 4 additions & 3 deletions src/4D_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,10 +1461,10 @@ PJ_INFO proj_info (void) {
pj_context_get_user_writable_directory(ctx, false).c_str(),
&buf_size);
}
const char *envPROJ_LIB = getenv("PROJ_LIB");
buf = path_append(buf, envPROJ_LIB, &buf_size);
const std::string envPROJ_LIB = NS_PROJ::FileManager::getProjLibEnvVar(ctx);
buf = path_append(buf, envPROJ_LIB.empty() ? nullptr : envPROJ_LIB.c_str(), &buf_size);
#ifdef PROJ_LIB
if (envPROJ_LIB == nullptr) {
if (envPROJ_LIB.empty()) {
buf = path_append(buf, PROJ_LIB, &buf_size);
}
#endif
Expand Down Expand Up @@ -1770,3 +1770,4 @@ PJ_FACTORS proj_factors(PJ *P, PJ_COORD lp) {

return factors;
}

2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ libproj_la_SOURCES = \
deriv.cpp ell_set.cpp ellps.cpp errno.cpp \
factors.cpp fwd.cpp init.cpp inv.cpp \
list.cpp malloc.cpp mlfn.cpp msfn.cpp proj_mdist.cpp \
open_lib.cpp param.cpp phi2.cpp pr_list.cpp \
param.cpp phi2.cpp pr_list.cpp \
qsfn.cpp strerrno.cpp \
tsfn.cpp units.cpp ctx.cpp log.cpp zpoly1.cpp rtodms.cpp \
release.cpp gauss.cpp \
Expand Down
Loading

0 comments on commit 8d8566c

Please sign in to comment.