Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Mar 2009 10:04:54 +0000
From:      Mike Clarke <jmc-freebsd2@milibyte.co.uk>
To:        freebsd-questions@freebsd.org, David Banning <david+dated+1237392898.23652b@skytracker.ca>
Subject:   Re: sed error "unescaped newline inside substitute pattern"
Message-ID:  <200903141004.54672.jmc-freebsd2@milibyte.co.uk>
In-Reply-To: <49BA8716.4040803@skytracker.ca>
References:  <20090312173436.GA51898@skytracker.ca> <49BA838D.8010703@gmx.com> <49BA8716.4040803@skytracker.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 13 March 2009, David Banning wrote:

> Yes - I have control of that - so I could filter out the problem in
> php. The only problem is that I don't know what I am filtering.
> If I know exactly what the erroneous characters are I could filter
> them - I have looked at the file in vi but the problematic characters
> are invisible there.

Would the php addcslashes() function do what you need?

<?php
$in = "This
is
the
input
from the
web server";
$out = addcslashes($in,"\n");
var_dump ($out);
?>

This results in:

string(42) "This\nis\nthe\ninput\nfrom the\nweb server" 

-- 
Mike Clarke



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903141004.54672.jmc-freebsd2>