any unhandled char below ascii 32 will now be encoded as utf8 (\uXXXX)
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 2 Jan 2007 21:33:59 +0000 (21:33 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 2 Jan 2007 21:33:59 +0000 (21:33 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@808 9efc2488-bf62-4759-914b-345cdb29e865

src/utils/utils.c

index 3c7a2d6..56b8e4e 100644 (file)
@@ -334,17 +334,9 @@ char* uescape( const char* string, int size, int full_escape ) {
                                                OSRF_BUFFER_ADD_CHAR(buf, '\\');
                                                break;
 
-                                       case 30: /* record separator */
-                                               OSRF_BUFFER_ADD(buf, "\\u001E");
-                                               break;
-
-                                       case 1: /* record separator */
-                                               OSRF_BUFFER_ADD(buf, "\\u0001");
-                                               break;
-
-
                                        default:
-                                               OSRF_BUFFER_ADD_CHAR(buf, c);
+                  if( c < 32 ) buffer_fadd(buf, "\\u%0.4x", c);
+                  else OSRF_BUFFER_ADD_CHAR(buf, c);
                                }
 
                        } else {