aboutsummaryrefslogtreecommitdiff
path: root/test/unit/gie_self_tests.cpp
diff options
context:
space:
mode:
authorBrendan Jurd <direvus@gmail.com>2021-08-15 21:30:57 +1000
committerGitHub <noreply@github.com>2021-08-15 13:30:57 +0200
commit17f83c6f122db849a8877ef0ca641d4743f352cd (patch)
tree0a98295fa2877197a3d64f726a2d7098307693e1 /test/unit/gie_self_tests.cpp
parenta46df0f3a298060ee8322237c849a17ff34e0989 (diff)
downloadPROJ-17f83c6f122db849a8877ef0ca641d4743f352cd.tar.gz
PROJ-17f83c6f122db849a8877ef0ca641d4743f352cd.zip
Add support for Degree Sign on input (#2791)
This commit adds support in dsmtor() for a Degree Sign (U+00B0), encoded as UTF-8 (`\xc2\xb0`) or as a single byte (`\xb0`) (in ISO 8859 parts 1-4, 7-10, 13, 15, 16, and several Windows code pages), as an alternative symbol to `D`/`d` to designate the degree unit. Fixes #2712.
Diffstat (limited to 'test/unit/gie_self_tests.cpp')
-rw-r--r--test/unit/gie_self_tests.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp
index c7c1ddf5..f0d4ea86 100644
--- a/test/unit/gie_self_tests.cpp
+++ b/test/unit/gie_self_tests.cpp
@@ -442,6 +442,12 @@ TEST(gie, info_functions) {
/* we can't expect perfect numerical accuracy so testing with a tolerance */
ASSERT_NEAR(-2.0, proj_dmstor(&buf[0], NULL), 1e-7);
+ /* test UTF-8 degree sign on DMS input */
+ ASSERT_NEAR(0.34512432, proj_dmstor("19°46'27\"E", NULL), 1e-7);
+
+ /* test ISO 8859-1, cp1252, et al. degree sign on DMS input */
+ ASSERT_NEAR(0.34512432, proj_dmstor("19" "\260" "46'27\"E", NULL), 1e-7);
+
/* test proj_derivatives_retrieve() and proj_factors_retrieve() */
P = proj_create(PJ_DEFAULT_CTX, "+proj=merc +ellps=WGS84");
a = proj_coord(0, 0, 0, 0);