This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vinay.sajip
Recipients vinay.sajip, zmk
Date 2012-04-05.14:53:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1333637632.01.0.87042437554.issue14452@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, I see what the problem is. I could go for option 1 - leave the BOM out, encode the string as UTF-8 but send it as just a bunch of bytes, i.e. the MSG-ANY variant of the spec. However, this could break any existing code that doesn't use structured data before the message, as you are doing, and relies on the MSG-UTF8 variant. So while agreeing with you that the situation isn't ideal, I don't see how I can change things while preserving backward compatibility, other than:

Introduce a class-level _insert_BOM attribute, defaulting to True but which can be set to False on a per-instance level. The BOM would only be inserted if this were True, so the current behaviour is preserved, but you could set the attribute to False and leave the BOM out. However, isn't ideal either, as it requires you to be sensitive to the exact version of Python in use - not easy if you're developing a library rather than an application.

I will consider a different approach in 3.3, e.g. provide one or more overridable methods to construct the message sent across the socket.

Thoughts? If these methods won't suffice, you can always resort to subclassing the handler and overriding the emit method (not that that's ideal, either).
History
Date User Action Args
2012-04-05 14:53:52vinay.sajipsetrecipients: + vinay.sajip, zmk
2012-04-05 14:53:52vinay.sajipsetmessageid: <1333637632.01.0.87042437554.issue14452@psf.upfronthosting.co.za>
2012-04-05 14:53:51vinay.sajiplinkissue14452 messages
2012-04-05 14:53:51vinay.sajipcreate