forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5f538ad
committed
Renovate display of non-ASCII messages on Windows.
GNU gettext selects a default encoding for the messages it emits in aplatform-specific manner; it uses the Windows ANSI code page on Windowsand follows LC_CTYPE on other platforms. This is inconvenient forPostgreSQL server processes, so realize consistent cross-platformbehavior by calling bind_textdomain_codeset() on Windows each time wepermanently change LC_CTYPE. This primarily affects SQL_ASCII databasesand processes like the postmaster that do not attach to a database,making their behavior consistent with PostgreSQL on non-Windowsplatforms. Messages from SQL_ASCII databases use the encoding impliedby the database LC_CTYPE, and messages from non-database processes useLC_CTYPE from the postmaster system environment. PlatformEncodingbecomes unused, so remove it.Make write_console() prefer WriteConsoleW() to write() regardless of theencodings in use. In this situation, write() will invariably mishandlenon-ASCII characters.elog.c has assumed that messages conform to the database encoding.While usually true, this does not hold for SQL_ASCII and MULE_INTERNAL.Introduce MessageEncoding to track the actual encoding of message text.The present consumers are Windows-specific code for converting messagesto UTF16 for use in system interfaces. This fixes the appearance inWindows event logs and consoles of translated messages from SQL_ASCIIprocesses like the postmaster. Note that SQL_ASCII inherently disclaimsa strong notion of encoding, so non-ASCII byte sequences interpolatedinto messages by %s may yet yield a nonsensical message. MULE_INTERNALhas similar problems at present, albeit for a different reason: its lackof libiconv support or a conversion to UTF8.Consequently, one need no longer restart Windows with a differentWindows ANSI code page to broadly test backend logging under a givenlanguage. Changing the user's locale ("Format") is enough. Severalaccounts can simultaneously run postmasters under different locales, allcorrectly logging localized messages to Windows event logs and consoles.Alexander Law and Noah Misch1 parent2c1031b commit5f538ad
File tree
9 files changed
+210
-65
lines changed- src
- backend
- main
- utils
- adt
- error
- init
- mb
- include
- mb
- port
9 files changed
+210
-65
lines changedLines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
265 | 265 |
| |
266 | 266 |
| |
267 | 267 |
| |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
268 | 272 |
| |
269 | 273 |
| |
270 | 274 |
| |
|
Lines changed: 26 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
131 | 131 |
| |
132 | 132 |
| |
133 | 133 |
| |
134 |
| - | |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
139 |
| - | |
140 |
| - | |
141 |
| - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
142 | 144 |
| |
143 | 145 |
| |
144 | 146 |
| |
| |||
172 | 174 |
| |
173 | 175 |
| |
174 | 176 |
| |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
175 | 193 |
| |
176 | 194 |
| |
177 | 195 |
| |
|
Lines changed: 37 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1813 | 1813 |
| |
1814 | 1814 |
| |
1815 | 1815 |
| |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
1816 | 1832 |
| |
1817 | 1833 |
| |
1818 | 1834 |
| |
| |||
1858 | 1874 |
| |
1859 | 1875 |
| |
1860 | 1876 |
| |
1861 |
| - | |
1862 |
| - | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
1863 | 1881 |
| |
1864 | 1882 |
| |
1865 |
| - | |
| 1883 | + | |
1866 | 1884 |
| |
1867 |
| - | |
1868 |
| - | |
| 1885 | + | |
| 1886 | + | |
1869 | 1887 |
| |
1870 |
| - | |
| 1888 | + | |
1871 | 1889 |
| |
1872 | 1890 |
| |
1873 | 1891 |
| |
| |||
1879 | 1897 |
| |
1880 | 1898 |
| |
1881 | 1899 |
| |
| 1900 | + | |
1882 | 1901 |
| |
1883 | 1902 |
| |
1884 | 1903 |
| |
| |||
1904 | 1923 |
| |
1905 | 1924 |
| |
1906 | 1925 |
| |
1907 |
| - | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
1908 | 1936 |
| |
1909 | 1937 |
| |
1910 | 1938 |
| |
1911 | 1939 |
| |
1912 | 1940 |
| |
1913 | 1941 |
| |
1914 |
| - | |
1915 |
| - | |
| 1942 | + | |
1916 | 1943 |
| |
1917 | 1944 |
| |
1918 | 1945 |
| |
1919 | 1946 |
| |
1920 | 1947 |
| |
1921 | 1948 |
| |
1922 |
| - | |
| 1949 | + | |
1923 | 1950 |
| |
1924 | 1951 |
| |
1925 | 1952 |
| |
|
Lines changed: 0 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
357 | 357 |
| |
358 | 358 |
| |
359 | 359 |
| |
360 |
| - | |
361 |
| - | |
362 |
| - | |
363 |
| - | |
364 |
| - | |
365 | 360 |
| |
366 | 361 |
| |
367 | 362 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
352 | 352 |
| |
353 | 353 |
| |
354 | 354 |
| |
| 355 | + | |
| 356 | + | |
355 | 357 |
| |
356 | 358 |
| |
357 | 359 |
| |
358 | 360 |
| |
| 361 | + | |
359 | 362 |
| |
360 | 363 |
| |
361 | 364 |
| |
| |||
389 | 392 |
| |
390 | 393 |
| |
391 | 394 |
| |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
392 | 402 |
| |
393 | 403 |
| |
394 | 404 |
| |
|
Lines changed: 93 additions & 39 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 |
| - | |
| 60 | + | |
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
| |||
881 | 881 |
| |
882 | 882 |
| |
883 | 883 |
| |
884 |
| - | |
885 |
| - | |
886 |
| - | |
887 | 884 |
| |
888 |
| - | |
| 885 | + | |
889 | 886 |
| |
890 |
| - | |
891 |
| - | |
892 |
| - | |
| 887 | + | |
| 888 | + | |
893 | 889 |
| |
894 |
| - | |
895 |
| - | |
896 |
| - | |
897 |
| - | |
898 |
| - | |
899 |
| - | |
900 |
| - | |
901 |
| - | |
902 |
| - | |
903 |
| - | |
904 |
| - | |
905 |
| - | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
906 | 893 |
| |
907 |
| - | |
908 |
| - | |
909 |
| - | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
910 | 905 |
| |
911 | 906 |
| |
912 | 907 |
| |
913 | 908 |
| |
914 | 909 |
| |
915 | 910 |
| |
916 |
| - | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
917 | 915 |
| |
| 916 | + | |
| 917 | + | |
| 918 | + | |
918 | 919 |
| |
919 | 920 |
| |
920 | 921 |
| |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
921 | 956 |
| |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
922 | 972 |
| |
| 973 | + | |
923 | 974 |
| |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
924 | 980 |
| |
925 | 981 |
| |
926 | 982 |
| |
| |||
949 | 1005 |
| |
950 | 1006 |
| |
951 | 1007 |
| |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
952 | 1014 |
| |
953 |
| - | |
| 1015 | + | |
954 | 1016 |
| |
955 |
| - | |
956 |
| - | |
957 |
| - | |
958 |
| - | |
959 |
| - | |
960 |
| - | |
961 |
| - | |
962 |
| - | |
963 |
| - | |
964 |
| - | |
| 1017 | + | |
| 1018 | + | |
965 | 1019 |
| |
966 | 1020 |
| |
967 | 1021 |
| |
| |||
971 | 1025 |
| |
972 | 1026 |
| |
973 | 1027 |
| |
974 |
| - | |
| 1028 | + | |
975 | 1029 |
| |
976 | 1030 |
| |
977 | 1031 |
| |
978 | 1032 |
| |
979 | 1033 |
| |
980 |
| - | |
| 1034 | + | |
981 | 1035 |
| |
982 | 1036 |
| |
983 | 1037 |
| |
| |||
994 | 1048 |
| |
995 | 1049 |
| |
996 | 1050 |
| |
997 |
| - | |
| 1051 | + | |
998 | 1052 |
| |
999 | 1053 |
| |
1000 | 1054 |
| |
|
0 commit comments
Comments
(0)