When using Django with PostGIS, escaping of geometries fail when the postgresql setting 'standard_conforming_string' is set to on. postgresql versions earlier 9.1 would not see this bug, because the default setting for standard_conforming_string is off. This patch (lifted from https://code.djangoproject.com/ticket/16778, all credits to the poster) fixes this issue with Django by fixing the escaping. The reply from the Django maintainers is that the patch won't be backported in the 1.3 series, so it would be great to get it added here. For others to find, the postgresql error I received when encountering this bug was: invalid byte sequence for encoding "UTF8": 0x00 Reproducible: Always
Created attachment 299331 [details, diff] Patch for proper escaping in Django PostGIS adapter
Created attachment 338268 [details, diff] Improved escaping of PostgreSQL geometries Attaching the actual patch to this bug instead of an entire HTML page.
No version <1.4 in the tree. Please reopen if still exists.