forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3159599
committed
Perform conversion from Python unicode to string/bytes object via UTF-8.
We used to convert the unicode object directly to a string in the serverencoding by calling Python's PyUnicode_AsEncodedString function. In otherwords, we used Python's routines to do the encoding. However, that has afew problems. First of all, it required keeping a mapping table of Pythonencoding names and PostgreSQL encodings. But the real killer was that Pythondoesn't support EUC_TW and MULE_INTERNAL encodings at all.Instead, convert the Python unicode object to UTF-8, and use PostgreSQL'sencoding conversion functions to convert from UTF-8 to server encoding. Wewere already doing the same in the other direction in PLyUnicode_FromString,so this is more consistent, too.Note: This makes SQL_ASCII to behave more leniently. We used to mapSQL_ASCII to Python's 'ascii', which on Python means strict 7-bit ASCIIonly, so you got an error if the python string contained anything but pureASCII. You no longer get an error; you get the UTF-8 representation of thestring instead.Backpatch to 9.0, where these conversions were introduced.Jan Urbański1 parentc9c9520 commit3159599
2 files changed
+44
-108
lines changedLines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 44 additions & 54 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4869 | 4869 |
| |
4870 | 4870 |
| |
4871 | 4871 |
| |
4872 |
| - | |
4873 |
| - | |
| 4872 | + | |
| 4873 | + | |
| 4874 | + | |
| 4875 | + | |
| 4876 | + | |
| 4877 | + | |
| 4878 | + | |
| 4879 | + | |
| 4880 | + | |
| 4881 | + | |
| 4882 | + | |
| 4883 | + | |
| 4884 | + | |
4874 | 4885 |
| |
4875 | 4886 |
| |
4876 |
| - | |
| 4887 | + | |
| 4888 | + | |
| 4889 | + | |
| 4890 | + | |
| 4891 | + | |
| 4892 | + | |
4877 | 4893 |
| |
4878 |
| - | |
| 4894 | + | |
4879 | 4895 |
| |
4880 |
| - | |
4881 |
| - | |
4882 |
| - | |
4883 |
| - | |
4884 |
| - | |
4885 |
| - | |
4886 |
| - | |
4887 |
| - | |
4888 |
| - | |
4889 |
| - | |
4890 |
| - | |
4891 |
| - | |
4892 |
| - | |
4893 |
| - | |
4894 |
| - | |
4895 |
| - | |
4896 |
| - | |
4897 |
| - | |
4898 |
| - | |
4899 |
| - | |
4900 |
| - | |
4901 |
| - | |
4902 |
| - | |
4903 |
| - | |
4904 |
| - | |
4905 |
| - | |
4906 |
| - | |
4907 |
| - | |
4908 |
| - | |
4909 |
| - | |
4910 |
| - | |
4911 |
| - | |
4912 |
| - | |
4913 |
| - | |
4914 |
| - | |
4915 |
| - | |
4916 |
| - | |
4917 |
| - | |
4918 |
| - | |
4919 |
| - | |
4920 |
| - | |
4921 |
| - | |
4922 |
| - | |
4923 |
| - | |
4924 |
| - | |
4925 |
| - | |
4926 |
| - | |
| 4896 | + | |
| 4897 | + | |
| 4898 | + | |
| 4899 | + | |
| 4900 | + | |
| 4901 | + | |
| 4902 | + | |
| 4903 | + | |
| 4904 | + | |
| 4905 | + | |
| 4906 | + | |
| 4907 | + | |
| 4908 | + | |
| 4909 | + | |
4927 | 4910 |
| |
| 4911 | + | |
| 4912 | + | |
4928 | 4913 |
| |
4929 |
| - | |
4930 |
| - | |
4931 |
| - | |
| 4914 | + | |
| 4915 | + | |
| 4916 | + | |
| 4917 | + | |
| 4918 | + | |
| 4919 | + | |
| 4920 | + | |
| 4921 | + | |
4932 | 4922 |
| |
4933 | 4923 |
| |
4934 | 4924 |
| |
|
0 commit comments
Comments
(0)