]> granicus.if.org Git - php/commitdiff
Replace Hebrew characters with escape sequences
authorPeter Kokot <peterkokot@gmail.com>
Thu, 21 Feb 2019 21:46:41 +0000 (22:46 +0100)
committerPeter Kokot <peterkokot@gmail.com>
Sat, 23 Feb 2019 21:17:15 +0000 (22:17 +0100)
calendar.c includes ISO-8859-8 encoded Hebrew characters, which may
cause compile errors, and is causing issues when saving file as UTF-8.
This patch replaces characters with appropriate escape sequences.

Following 99fdf5916eccbd72c10cc4d84693e677996b1229.

ext/calendar/calendar.c

index 721311316f67d8533650a85da1da76df2f99d4c5..3c7236de9a9cda54a64add86bd9ac865c3746367 100644 (file)
@@ -217,8 +217,9 @@ enum { CAL_MONTH_GREGORIAN_SHORT, CAL_MONTH_GREGORIAN_LONG,
        CAL_MONTH_FRENCH
 };
 
-/* for heb_number_to_chars */
-static char alef_bet[25] = "0àáâãäåæçèéëìîðñòôö÷øùú";
+/* For heb_number_to_chars escape sequences of אבגדהוזחטיכלמנסעפצקרשת
+   ISO-8859-8 Hebrew alphabet */
+static char alef_bet[25] = "0\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEB\xEC\xEE\xF0\xF1\xF2\xF4\xF6\xF7\xF8\xF9\xFA";
 
 #define CAL_JEWISH_ADD_ALAFIM_GERESH 0x2
 #define CAL_JEWISH_ADD_ALAFIM 0x4
@@ -505,7 +506,7 @@ PHP_FUNCTION(juliantojd)
 /* {{{ heb_number_to_chars*/
 /*
 caution: the Hebrew format produces non unique result.
-for example both: year '5' and year '5000' produce 'ä'.
+for example both: year '5' and year '5000' produce 'ה'.
 use the numeric one for calculations.
  */
 static char *heb_number_to_chars(int n, int fl, char **ret)
@@ -532,7 +533,8 @@ static char *heb_number_to_chars(int n, int fl, char **ret)
                        p++;
                }
                if (CAL_JEWISH_ADD_ALAFIM & fl) {
-                       strcpy(p, " àìôéí ");
+                       /* Escape sequences of Hebrew characters in ISO-8859-8: אלפים */
+                       strcpy(p, " \xE0\xEC\xF4\xE9\xED ");
                        p += 7;
                }