forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7fbe5aa
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 parentbb49e35 commit7fbe5aa
File tree
3 files changed
+44
-158
lines changed- src/pl/plpython
- expected
3 files changed
+44
-158
lines changedLines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 44 additions & 54 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3686 | 3686 |
| |
3687 | 3687 |
| |
3688 | 3688 |
| |
3689 |
| - | |
3690 |
| - | |
| 3689 | + | |
| 3690 | + | |
| 3691 | + | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
| 3698 | + | |
| 3699 | + | |
| 3700 | + | |
| 3701 | + | |
3691 | 3702 |
| |
3692 | 3703 |
| |
3693 |
| - | |
| 3704 | + | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
| 3708 | + | |
| 3709 | + | |
3694 | 3710 |
| |
3695 |
| - | |
| 3711 | + | |
3696 | 3712 |
| |
3697 |
| - | |
3698 |
| - | |
3699 |
| - | |
3700 |
| - | |
3701 |
| - | |
3702 |
| - | |
3703 |
| - | |
3704 |
| - | |
3705 |
| - | |
3706 |
| - | |
3707 |
| - | |
3708 |
| - | |
3709 |
| - | |
3710 |
| - | |
3711 |
| - | |
3712 |
| - | |
3713 |
| - | |
3714 |
| - | |
3715 |
| - | |
3716 |
| - | |
3717 |
| - | |
3718 |
| - | |
3719 |
| - | |
3720 |
| - | |
3721 |
| - | |
3722 |
| - | |
3723 |
| - | |
3724 |
| - | |
3725 |
| - | |
3726 |
| - | |
3727 |
| - | |
3728 |
| - | |
3729 |
| - | |
3730 |
| - | |
3731 |
| - | |
3732 |
| - | |
3733 |
| - | |
3734 |
| - | |
3735 |
| - | |
3736 |
| - | |
3737 |
| - | |
3738 |
| - | |
3739 |
| - | |
3740 |
| - | |
3741 |
| - | |
3742 |
| - | |
3743 |
| - | |
| 3713 | + | |
| 3714 | + | |
| 3715 | + | |
| 3716 | + | |
| 3717 | + | |
| 3718 | + | |
| 3719 | + | |
| 3720 | + | |
| 3721 | + | |
| 3722 | + | |
| 3723 | + | |
| 3724 | + | |
| 3725 | + | |
| 3726 | + | |
3744 | 3727 |
| |
| 3728 | + | |
| 3729 | + | |
| 3730 | + | |
| 3731 | + | |
| 3732 | + | |
| 3733 | + | |
| 3734 | + | |
| 3735 | + | |
| 3736 | + | |
3745 | 3737 |
| |
3746 |
| - | |
3747 |
| - | |
3748 |
| - | |
| 3738 | + | |
3749 | 3739 |
| |
3750 | 3740 |
| |
3751 | 3741 |
| |
|
0 commit comments
Comments
(0)