1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
Description: Fix unicode support for printing the degree (0xB0) character
Author: Adam Borowski <kilobyte@angband.pl>
Bug-Debian: https://bugs.debian.org/755269
diff -Nurd itools-1.0.orig/ipraytime.c itools-1.0/ipraytime.c
--- itools-1.0.orig/ipraytime.c 2009-07-06 22:41:13.000000000 +0200
+++ itools-1.0/ipraytime.c 2014-10-30 16:58:13.301433287 +0100
@@ -30,6 +30,7 @@
#include <string.h> /* for strlen/strcat/etc */
#include <unistd.h> /* for getuid */
#include <pwd.h> /* for getpwuid */
+#include <locale.h> /* for setlocale */
/* For time_t */
#ifdef TM_IN_SYS_TIME
@@ -460,7 +461,7 @@
int deg, min;
double sec;
- const char symb = (char)0xB0;
+ const wchar_t symb = 0xB0;
printf("\n");
printf("Prayer schedule for,\n");
@@ -470,11 +471,11 @@
printf(" City : %s\n", city_name);
decimal2Dms(loc->degreeLat, °, &min, &sec);
- printf(" Latitude : %03d%c %02d\' %02d\" %c\n", abs(deg), symb,
+ printf(" Latitude : %03d%lc %02d\' %02d\" %c\n", abs(deg), symb,
abs(min), abs(sec), (loc->degreeLat >=0 ? 'N' : 'S'));
decimal2Dms(loc->degreeLong, °, &min, &sec);
- printf(" Longitude : %03d%c %02d\' %02d\" %c\n", abs(deg), symb,
+ printf(" Longitude : %03d%lc %02d\' %02d\" %c\n", abs(deg), symb,
abs(min), abs(sec), (loc->degreeLong >=0 ? 'E' : 'W'));
printf(" Angle Method : %s\n", method_name);
@@ -485,7 +486,7 @@
/* Deal with Qibla Information */
qibla = getNorthQibla(loc);
decimal2Dms (qibla, °, &min, &sec);
- printf(" Qibla : %03d%c %02d\' %02d\" %c of true North\n",
+ printf(" Qibla : %03d%lc %02d\' %02d\" %c of true North\n",
abs (deg), symb, abs (min), abs (sec), (qibla >=0 ? 'W' : 'E'));
printf("\n");
@@ -645,6 +646,8 @@
Date dst_end;
sPref user_input;
+ setlocale(LC_CTYPE, "");
+
/* Read-in the init RC file */
do_init_file(&user_input, &loc, &date);
|