From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 2B5C7BC57 for ; Tue, 8 Jun 2010 21:36:32 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am4BAPc4DkxKfVK0kGdsb2JhbACeOggVAQEBAQkJDAcRAx+vF4IChTQuiE8BAQMFhREE X-IronPort-AV: E=Sophos;i="4.53,385,1272837600"; d="scan'208";a="64204158" Received: from mail-wy0-f180.google.com ([74.125.82.180]) by mail4-smtp-sop.national.inria.fr with ESMTP; 08 Jun 2010 21:36:31 +0200 Received: by wyb34 with SMTP id 34so4092839wyb.39 for ; Tue, 08 Jun 2010 12:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=MzqPY+o6ZLwFUD1XhmHVcy5MYrT7+ARlKDXw/kDMpow=; b=VCMl+SX5Dt0/YbV8eWRJ/82fUPzcH5RrKIaSazR2Y4+72Ml8yW1lBoz1IombEDtI07 krug97/EjBFAJFcoHqTPrlTTXu9CfFnTdQ3pnkDeaAe285AjQxPsnNuIiO6r3M6JNnZJ yqp0Wv6qkZ+0u4r+Czc3MgQCYDdJyncqZ+934= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Py1dWUTQpPetZ6Tk5TRmANNr9KaCnlJmda2T3Q0h+k++NkyMgRvtquFhp2gOBn+XWF dwdK4Jdb9Zc4ImuaIudkATGc5LCdCXTBP9gvplte6nBsrPjvv2QCEQcDGzkiHLzNwvSB UpAZ+vMIzWRkN9yBtsNqb3qSXc7eXumhUGrEE= MIME-Version: 1.0 Received: by 10.216.86.19 with SMTP id v19mr3851183wee.89.1276025784620; Tue, 08 Jun 2010 12:36:24 -0700 (PDT) Received: by 10.216.70.206 with HTTP; Tue, 8 Jun 2010 12:36:24 -0700 (PDT) In-Reply-To: <4C0E9177.4080802@inescporto.pt> References: <4C0E6561.20207@inescporto.pt> <4C0E9177.4080802@inescporto.pt> Date: Tue, 8 Jun 2010 15:36:24 -0400 Message-ID: Subject: Re: [Caml-list] Escaped string in sexplib From: Markus Mottl To: Hugo Ferreira Cc: caml-list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; markus:01 mottl:01 markus:01 mottl:01 sexp:01 sexp:01 escapes:01 parser:01 ocaml:01 wrote:01 encode:01 caml-list:01 strings:01 data:02 data:02 On Tue, Jun 8, 2010 at 14:52, Hugo Ferreira wrote: > My apologies but I did not explain myself correctly. The problem here is > that I am trying to automate the conversion to string of the data > structure read from the s-expressions. I have the following: > > let string_of_experiment_data data =3D > =A0let data =3D sexp_of_experiment_data data in > =A0Sexplib.Sexp.to_string_hum data > > The problem here is that the "to_string_hum" escapes certain characters, > but I need to have the strings "not escaped". So my question is: is > their any way I can tell sexplib to output a string but not escape > it? Otherwise I will have to hand encode this stuff 8-( Sexplib does not support any other way of printing S-expressions. There would not be any reliable way to read back data without escaping. If you want to write your own printers, this should still be very easy. S-expressions are either a Sexp.Atom or Sexp.List. It should only require a handful of lines to convert these to whatever other string representation you prefer. Writing a corresponding parser may be more effort. Regards, Markus --=20 Markus Mottl http://www.ocaml.info markus.mottl@gmail.com