You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, text_out is causing errors with Apple's CalendarServer. Details of the issue here.
TL;DR is that I can fix the immediate problem by applying this patch:
diff --git a/pg8000/core.py b/pg8000/core.py
index 246e0b6..14093cc 100644
--- a/pg8000/core.py
+++ b/pg8000/core.py
@@ -1350,6 +1350,7 @@ class Connection(object):
self.ParameterStatusReceived += self.handle_PARAMETER_STATUS
def text_out(v):
+ if not isinstance(v, text_type): return v
return v.encode(self._client_encoding)
def time_out(v):
However I'm not sure if this is best for pg8000 in general. Please let me know what you think, and also if we need to patch CalendarServer in some other way as well.
The text was updated successfully, but these errors were encountered:
The short answer is that under Python 2 it's probably a good idea to send strings as unicode() objects, rather than str() objects.
Having said that, I think that pg8000 is doing the wrong thing when running under Python 2. If it receives a str() it should really send it unmodified (ie. use the bytea_send() method). I'll go ahead and put something up and see what people think.
For sending a str under Python 2 we used to do an encode() on it, then
send it. The problem was this first does an implicit decode() with the
default encoding (usually ascii) and the decode would fail on anything
that wasn't valid ascii encoded bytes. To solve that we now say that
under Python 2, str types are sent unmodified. For users of the library
it's safest to send strings using the unicode type. I've pushed this change to the main rep.
Hi,
text_out
is causing errors with Apple's CalendarServer. Details of the issue here.TL;DR is that I can fix the immediate problem by applying this patch:
However I'm not sure if this is best for pg8000 in general. Please let me know what you think, and also if we need to patch CalendarServer in some other way as well.
The text was updated successfully, but these errors were encountered: