[Opensrf-commits] r1683 - branches/rel_1_0/src/libopensrf (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 25 18:45:48 EDT 2009


Author: erickson
Date: 2009-03-25 18:45:48 -0400 (Wed, 25 Mar 2009)
New Revision: 1683

Modified:
   branches/rel_1_0/src/libopensrf/osrf_json_object.c
Log:
hash keys have to be escaped like regular strings

Modified: branches/rel_1_0/src/libopensrf/osrf_json_object.c
===================================================================
--- branches/rel_1_0/src/libopensrf/osrf_json_object.c	2009-03-25 22:35:45 UTC (rev 1682)
+++ branches/rel_1_0/src/libopensrf/osrf_json_object.c	2009-03-25 22:45:48 UTC (rev 1683)
@@ -322,7 +322,12 @@
 
 			while( (item = osrfHashIteratorNext(itr)) ) {
 				if(i++ > 0) OSRF_BUFFER_ADD(buf, ",");
-				buffer_fadd(buf, "\"%s\":", osrfHashIteratorKey(itr));
+			    char* data = osrfHashIteratorKey(itr);
+			    int len = strlen(data);
+			    char* output = uescape(data, len, 1);
+			    OSRF_BUFFER_ADD(buf, output);
+				buffer_fadd(buf, "\"%s\":", output);
+			    free(output);
 				add_json_to_buffer( item, buf );
 			}
 



More information about the opensrf-commits mailing list