[pyar] WTF struct.unpack y problemas con encoding????

Roberto Alsina ralsina en netmanagers.com.ar
Lun Oct 4 11:08:04 ART 2010


On Monday 04 October 2010 10:56:40 Alejandro Santos wrote:
> Si vas a usar json capaz te convenga codificar los datos con base64 (o
> alguna codificacion equivalente) asi no se pierden cosas en el camino.

json codifica unicode lo más bien... de hecho, json REQUIERE que mandes y 
recibas siempre en unicode (normalmente utf8).

http://www.ietf.org/rfc/rfc4627.txt

Especificamente la sección 3, "Encoding":

3.  Encoding

   JSON text SHALL be encoded in Unicode.  The default encoding is
   UTF-8.

   Since the first two characters of a JSON text will always be ASCII
   characters [RFC0020], it is possible to determine whether an octet
   stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking
   at the pattern of nulls in the first four octets.

           00 00 00 xx  UTF-32BE
           00 xx 00 xx  UTF-16BE
           xx 00 00 00  UTF-32LE
           xx 00 xx 00  UTF-16LE
           xx xx xx xx  UTF-8



More information about the pyar mailing list