Good cross-version ASCII serialisation protocol for simple types

2013-02-23 Thread Paul Moore
I need to transfer some data (nothing fancy, some dictionaries, strings, numbers and lists, basically) between 2 Python processes. However, the data (string values) is potentially not ASCII, but the transport is (I'm piping between 2 processes, but thanks to nasty encoding issues, the only

Re: Good cross-version ASCII serialisation protocol for simple types

2013-02-23 Thread Chris Angelico
On Sun, Feb 24, 2013 at 2:45 AM, Paul Moore p.f.mo...@gmail.com wrote: At the moment, I'm using encoded = json.dumps([ord(c) for c in json.dumps(obj)]) decoded = json.loads(''.join([chr(n) for n in json.loads(encoded)])) The double-encoding ensures that non-ASCII characters don't make it

Re: Good cross-version ASCII serialisation protocol for simple types

2013-02-23 Thread Irmen de Jong
On 23-2-2013 16:45, Paul Moore wrote: I need to transfer some data (nothing fancy, some dictionaries, strings, numbers and lists, basically) between 2 Python processes. However, the data (string values) is potentially not ASCII, but the transport is (I'm piping between 2 processes, but

Re: Good cross-version ASCII serialisation protocol for simple types

2013-02-23 Thread Jussi Piitulainen
Paul Moore writes: I need to transfer some data (nothing fancy, some dictionaries, strings, numbers and lists, basically) between 2 Python processes. However, the data (string values) is potentially not ASCII, but the transport is (I'm piping between 2 processes, but thanks to nasty

Re: Good cross-version ASCII serialisation protocol for simple types

2013-02-23 Thread Paul Moore
On Saturday, 23 February 2013 16:06:11 UTC, Jussi Piitulainen wrote: I don't know much of these things but I've been using Python's json.dump and json.load for a couple of weeks now and they seem to use ASCII-friendly escapes automatically, writing a four-character string as \u00e4\u00e4ni