mirror of
https://github.com/postgres/postgres.git
synced 2026-03-16 07:32:54 -04:00
We used to convert the unicode object directly to a string in the server encoding by calling Python's PyUnicode_AsEncodedString function. In other words, we used Python's routines to do the encoding. However, that has a few problems. First of all, it required keeping a mapping table of Python encoding names and PostgreSQL encodings. But the real killer was that Python doesn't support EUC_TW and MULE_INTERNAL encodings at all. Instead, convert the Python unicode object to UTF-8, and use PostgreSQL's encoding conversion functions to convert from UTF-8 to server encoding. We were 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 map SQL_ASCII to Python's 'ascii', which on Python means strict 7-bit ASCII only, so you got an error if the python string contained anything but pure ASCII. You no longer get an error; you get the UTF-8 representation of the string instead. Backpatch to 9.0, where these conversions were introduced. Jan Urbański |
||
|---|---|---|
| .. | ||
| plpython_composite.out | ||
| plpython_do.out | ||
| plpython_drop.out | ||
| plpython_error.out | ||
| plpython_error_0.out | ||
| plpython_global.out | ||
| plpython_import.out | ||
| plpython_newline.out | ||
| plpython_params.out | ||
| plpython_populate.out | ||
| plpython_quote.out | ||
| plpython_record.out | ||
| plpython_schema.out | ||
| plpython_setof.out | ||
| plpython_spi.out | ||
| plpython_subtransaction.out | ||
| plpython_subtransaction_0.out | ||
| plpython_subtransaction_5.out | ||
| plpython_test.out | ||
| plpython_trigger.out | ||
| plpython_types.out | ||
| plpython_types_3.out | ||
| plpython_unicode.out | ||
| plpython_void.out | ||
| README | ||
Guide to alternative expected files: plpython_error_0.out Python 2.4 and older plpython_unicode.out server encoding != SQL_ASCII plpython_unicode_3.out server encoding == SQL_ASCII plpython_subtransaction_0.out Python 2.4 and older (without with statement) plpython_subtransaction_5.out Python 2.5 (without with statement) plpython_types_3.out Python 3.x