[PHP] carriage return

2005-08-05 Thread Diana Castillo
How can I with php detect when there is a carriage return at the end of the 
text field in a mysql table?


-- 
Diana Castillo
Destinia.com
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 Ext 216
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] carriage return

2005-08-05 Thread Jochem Maas

Diana Castillo wrote:
How can I with php detect when there is a carriage return at the end of the 
text field in a mysql table?


get the data out of the DB first. stick it in $myString




$myString = wtf I fond a carriage return - horsedrawn even.\n;
if (preg_match(#[\n|\r|\r\n]$#, $myString)) {
echo wtf I fond a carriage return - horsedrawn even.;
}

tip: using trim() on $myString will strip a trailing CR.
tip: want to allow blank spaces after the CR, use this regexp instead.
#[\n|\r|\r\n][ ]*$# e.g:

$myString = wtf I fond a carriage return - horsedrawn even.\r\n   ;
if (preg_match(#[\n|\r|\r\n][ ]*$#, $myString)) {
echo wtf I fond a carriage return - horsedrawn even.;
}


now can I have your roomkey? :-P


also if you want to know what \n and \r and \r\n are about then you might
start by searching for posts by Marco Tabini 3 days back on this list






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] carriage return

2005-08-05 Thread Frank de Bot

Diana Castillo wrote:

How can I with php detect when there is a carriage return at the end of the 
text field in a mysql table?


 


Something like this perhaps:

$res = mysql_query($query);
$row = mysql_fetch_object($row)
if (preg_match(/\r$/,$row-textfield) {
   echo Got CR;
} else {
   echo No CR at end;
}


Just an example to help you on the way.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Carriage Return problem!

2005-04-12 Thread Dipesh Khakhkhar
Hi,

I am using php to generate and xml output file from another xml file using xsl.

The file is getting created properly and the xml instruction element is at 1st 
line.

I am using ant to get the output remotely but it is adding one extra line i.e. 
carriage return. I checked everything in my xsl, tried xsl:strip-space, no 
indent etc but as i said file is properly created. I have checked my echo's and 
print statments but there is none.

If somebody has tried to direct the output of browser through ant (or some 
other tool) and came across the same situation and tackled it please inform me. 
Does the php interpreter enters a carriage return by default as i tried to 
remome the xml contents and print one normal line of output it still gave me 
carriage return in the first line.

Any help will be highly appreciated.
Thanks!


Re: [PHP] Carriage Return problem!

2005-04-12 Thread Brandon Ryan
Make sure there are no extra characters (including linefeeds) after the 
closing ? in your php source file.
 Brandon Ryan
 On 12 Apr 2005 19:42:17 -, Dipesh Khakhkhar 
[EMAIL PROTECTED] wrote: 
 
 Hi,
 
 I am using php to generate and xml output file from another xml file using 
 xsl.
 
 The file is getting created properly and the xml instruction element is at 
 1st line.
 
 I am using ant to get the output remotely but it is adding one extra line 
 i.e. carriage return. I checked everything in my xsl, tried 
 xsl:strip-space, no indent etc but as i said file is properly created. I 
 have checked my echo's and print statments but there is none.
 
 If somebody has tried to direct the output of browser through ant (or some 
 other tool) and came across the same situation and tackled it please inform 
 me. Does the php interpreter enters a carriage return by default as i tried 
 to remome the xml contents and print one normal line of output it still gave 
 me carriage return in the first line.
 
 Any help will be highly appreciated.
 Thanks!
 



Re: [PHP] carriage return/line break problem

2002-08-26 Thread David T-G

Pag --

...and then Pag said...
% 
% At 16:46 24-08-2002 +0200, Bas Jobsen wrote:
% use nl2br($content);
% 
% I assume i should use that function when sending to the page, 

Right; it will convert newlines to linebreaks.


% after retrieving the text from the DB, right? Cant i do something when 

That's generally when one would do it.  I tend to just use pre tags
when I need to preserve line breaks rather than converting content,
personally.


% getting the text TO the db and then when i need it, i can just retrieve it, 
% ready to be put on the page?

If you don't mind having HTML code in the database, then go ahead and
convert it a la

  $content = nl2br($content) ;

before writing it to the DB and then it will be that way when it comes
out.


% 
% Thanks.

Sure thing!


% 
% Pag


HTH  HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg76680/pgp0.pgp
Description: PGP signature


[PHP] Carriage return.

2001-09-05 Thread Johan Vikerskog (EMP)

My php script is generating a file that is saved in Unix format.
I automatically get the ^M in the end of everyline. Is there a way
of saving this without getting the ^M in the end of each line?

Thanks in advance

//Johan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Carriage return.

2001-09-05 Thread David Robley

On Wed,  5 Sep 2001 17:22, Johan Vikerskog (EMP) wrote:
 My php script is generating a file that is saved in Unix format.
 I automatically get the ^M in the end of everyline. Is there a way
 of saving this without getting the ^M in the end of each line?

 Thanks in advance

 //Johan

If you are getting a ^M something is a bit wrong as that is xOD the CR 
character. What system are you on and what is the relevant part of your 
script?

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   I smell a rat. Did you bake it or fry it?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Carriage return.

2001-09-05 Thread Johan Vikerskog (EMP)

My users perform their action which is to simulate data online with my script.
Afterwards they get a result of their simulation. They have a option to save the 
result to a file and when they do that they get the ^M.

//Johan

-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: den 5 september 2001 10:29
To: Johan Vikerskog (EMP); php_list
Subject: Re: [PHP] Carriage return.


On Wed,  5 Sep 2001 17:22, Johan Vikerskog (EMP) wrote:
 My php script is generating a file that is saved in Unix format.
 I automatically get the ^M in the end of everyline. Is there a way
 of saving this without getting the ^M in the end of each line?

 Thanks in advance

 //Johan

If you are getting a ^M something is a bit wrong as that is xOD the CR 
character. What system are you on and what is the relevant part of your 
script?

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   I smell a rat. Did you bake it or fry it?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Carriage return.

2001-09-05 Thread _lallous

anyway, the ^M is same as \r or \x0D
you can call preg_replace(\x0D, , $your_output);

Johan Vikerskog [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]..
.
 My users perform their action which is to simulate data online with my
script.
 Afterwards they get a result of their simulation. They have a option to
save the result to a file and when they do that they get the ^M.

 //Johan

 -Original Message-
 From: David Robley [mailto:[EMAIL PROTECTED]]
 Sent: den 5 september 2001 10:29
 To: Johan Vikerskog (EMP); php_list
 Subject: Re: [PHP] Carriage return.


 On Wed,  5 Sep 2001 17:22, Johan Vikerskog (EMP) wrote:
  My php script is generating a file that is saved in Unix format.
  I automatically get the ^M in the end of everyline. Is there a way
  of saving this without getting the ^M in the end of each line?
 
  Thanks in advance
 
  //Johan

 If you are getting a ^M something is a bit wrong as that is xOD the CR
 character. What system are you on and what is the relevant part of your
 script?

 --
 David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
 CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA

I smell a rat. Did you bake it or fry it?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Carriage return.

2001-09-05 Thread Jon Farmer

 My php script is generating a file that is saved in Unix format.
 I automatically get the ^M in the end of everyline. Is there a way
 of saving this without getting the ^M in the end of each line?


/usr/bin/perl -npe 's/\r\n/\n/g' filename

will remove the Ctrl-M characters for you. You could call it straight after
the line that generates the file.

Regards

Jon


--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07968 524175
PGP Key available, send blank email to [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Carriage return.

2001-09-05 Thread Johan Vikerskog (EMP)

I knew that one Jon but thanks for looking it up for me.
What i need to know is if there is a way to do this without involving unix commands 
like perl sed dos2unix etc etc.
I need to know if there is a simple way to do this with just php and not some regexp 
solution.
I want to know if there is a built in function of some kind that will do this.

//Johan

-Original Message-
From: Jon Farmer [mailto:[EMAIL PROTECTED]]
Sent: den 5 september 2001 11:44
To: Johan Vikerskog (EMP); php_list
Subject: Re: [PHP] Carriage return.


 My php script is generating a file that is saved in Unix format.
 I automatically get the ^M in the end of everyline. Is there a way
 of saving this without getting the ^M in the end of each line?


/usr/bin/perl -npe 's/\r\n/\n/g' filename

will remove the Ctrl-M characters for you. You could call it straight after
the line that generates the file.

Regards

Jon


--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07968 524175
PGP Key available, send blank email to [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Carriage return.

2001-09-05 Thread Alexander Skwar

So sprach »Johan Vikerskog (EMP)« am 2001-09-05 um 11:48:11 +0200 :

 What i need to know is if there is a way to do this without involving
 unix commands like perl sed dos2unix etc etc.  I need to know if
 there is a simple way to do this with just php and not some regexp
 solution.  I want to know if there is a built in function of some kind

What's bad about regexp?  No, there's nothing builtin.  Anyway - why
should there?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Carriage return.

2001-09-05 Thread Christopher William Wesley

On Wed, 5 Sep 2001, Johan Vikerskog (EMP) wrote:

 My php script is generating a file that is saved in Unix format.
 I automatically get the ^M in the end of everyline. Is there a way
 of saving this without getting the ^M in the end of each line?

The ^M you see is a DOS carriage return/line feed.
It seems your PHP script is printing \r\n at the end of lines.
If you want Unix line feeds, your PHP script should print \n only.

~Chris   /\
 \ / Pine Ribbon Campaign
Microsoft Security Specialist X  Against Outlook
The moron in Oxymoron.   / \ http://www.thebackrow.net




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] carriage return (writing files)

2001-05-09 Thread Magnus Lawrie

hello,
I'm writing to files with php. How do I include a carriage return, i.e.
write strings to different lines in a text file?
Thanks,


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] carriage return (writing files)

2001-05-09 Thread Jack Dempsey

Magnus Lawrie wrote:
 
 hello,
 I'm writing to files with php. How do I include a carriage return, i.e.
 write strings to different lines in a text file?
 Thanks,
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

echo foo\n; #-- the \n is a newline
echo foo\r; #-- the \r is a carriage return

what you use will depend on what system you're working on...if *nix, \n
will do...

-jack

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] carriage return in multipart/form-data form post

2001-03-05 Thread Jeff Schwartz

We've just moved to a new server and I'm running into an odd problem. The
code is below. On my old server it correctly returns:

[test] 
t 116
e 101
s 115
t 116

But on my new server I get:

[ test] 
13
10
t 116
e 101
s 115
t 116

Has anyone else run into this?

?php
echo "[$action] BR ";
while ($action){
$c = substr($action,0,1);
$action = substr($action,1);
echo "$c " . ord($c) . "BR";
}
?

FORM ENCTYPE='multipart/form-data' ACTION='z.html' METHOD='POST'
input type="hidden" name="action" value="test"
INPUT TYPE='submit' VALUE='Process'/FORM


__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] carriage return in multipart/form-data form post

2001-03-05 Thread Chris Lee


form method=post action='$PHP_SELF'
input type=submit
/form

even the simplest forms product a 0x013 0x10 imediatly after the form I wish there 
was a way to control this behaviour. I thought it was normal, and anoying.


-- 

 Chris Lee
 Mediawaveonline.com

 ph. 250.377.1095
 ph. 250.376.2690
 fx. 250.554.1120

 [EMAIL PROTECTED]


"Jeff Schwartz" [EMAIL PROTECTED] wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
We've just moved to a new server and I'm running into an odd problem. The
code is below. On my old server it correctly returns:

[test] 
t 116
e 101
s 115
t 116

But on my new server I get:

[ test] 
13
10
t 116
e 101
s 115
t 116

Has anyone else run into this?

?php
echo "[$action] BR ";
while ($action){
$c = substr($action,0,1);
$action = substr($action,1);
echo "$c " . ord($c) . "BR";
}
?

FORM ENCTYPE='multipart/form-data' ACTION='z.html' METHOD='POST'
input type="hidden" name="action" value="test"
INPUT TYPE='submit' VALUE='Process'/FORM


__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]