aboutsummaryrefslogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-03 15:43:30 +1100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-03 15:43:30 +1100
commit9edde5ff28780ed60a7ccfc47d4bf305c5c83fe1 (patch)
tree5a3e3f23a03850bce47a59b0022b817b6e19d12d /info.c
parent6fa9e02723d17c6ccc0e001b9e4b11c2acb93e98 (diff)
downloadsubsurface-9edde5ff28780ed60a7ccfc47d4bf305c5c83fe1.tar.gz
Correctly parse translated cardinal directions
We now compare to both the standard English characters ('N', 'E', etc) as well as to the translated strings (_("N"), _("E")) when parsing GPS strings. Reported-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'info.c')
-rw-r--r--info.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/info.c b/info.c
index 5e47a2590..3736d296c 100644
--- a/info.c
+++ b/info.c
@@ -401,9 +401,11 @@ static gboolean parse_gps_text(const char *gps_text, double *latitude, double *l
return TRUE;
}
/* ok, let's parse by hand - first degrees of latitude */
- if (g_unichar_toupper(g_utf8_get_char(text)) == 'N')
+ if (g_unichar_toupper(g_utf8_get_char(text)) == 'N' ||
+ !strncmp(text, _("N"), strlen(_("N"))))
text++;
- if (g_unichar_toupper(g_utf8_get_char(text)) == 'S') {
+ if (g_unichar_toupper(g_utf8_get_char(text)) == 'S' ||
+ !strncmp(text, _("S"), strlen(_("S")))) {
text++;
south = TRUE;
}
@@ -433,9 +435,11 @@ static gboolean parse_gps_text(const char *gps_text, double *latitude, double *l
text = g_utf8_next_char(text);
/* next degrees of longitude */
- if (g_unichar_toupper(g_utf8_get_char(text)) == 'E')
+ if (g_unichar_toupper(g_utf8_get_char(text)) == 'E' ||
+ !strncmp(text, _("E"), strlen(_("E"))))
text++;
- if (g_unichar_toupper(g_utf8_get_char(text)) == 'W') {
+ if (g_unichar_toupper(g_utf8_get_char(text)) == 'W' ||
+ !strncmp(text, _("W"), strlen(_("W")))) {
text++;
west = TRUE;
}