Hi, > mmy [SMTP:[EMAIL PROTECTED] wrote on tuesday, april 1, 2003 21:45 > > ..., but never > the basic syntax! >
This is M$ of its earliest days, there is no such thing like a "basic syntax". "+" is special to DOS at least with the copy command in that "copy a+b.txt" means: take file "a" and file "b.txt" and concatenate them giving file a. But you have already tried type ... A file named "a+b.txt" is legal with WIN95 and later but not with DOS. A file named "a+b.txt" is fed to DOS with its "short name" (e.g. A_B~1.TXT). You can see this with the dir command. In old DOS manuals you could find the allowable characters for file names. But this is garbage anyway because it held true for the command line only. Programmatically you could at all times take any ASCII code for a character in a file name (including zero, btw...). If you knew what you were doing. And there had not been any warranty that third parties counted the result for a valid file name. And sometimes this was intended... Back to your problem: the treatment of + on the command line has been changed recently. My versions PHP 4.4-dev, PHP 4.3.0RC1 e.g. have $GLOBALS['argv'] as an array, one entry being "a+b.txt", quoted or not. CMDLINE reads: plus.php "a+b.txt" PHP 4.2.2 has three entrys, one being a and one being b.txt, whereas PHP 4.3.2-RC has argc, argv only in the CLI build. CMDLINE reads: plus.php \"a+b.txt\" So to solve your problem you should settle for filenames without a plus sign in it. It's bad with *nix anyway. If you lack that option take a modern version of PHP, quote the filenames and pray. -- Sven Schnitzke > -----Ursprüngliche Nachricht----- > Von: mmy [SMTP:[EMAIL PROTECTED] > Gesendet am: Dienstag, 1. April 2003 21:45 > An: [EMAIL PROTECTED] > Betreff: [PHP-WIN] Re: Subject: + character in a command line argument > > Thanks for the try! > >... > > Still nothing to escape the +... > "Max Graham" <[EMAIL PROTECTED]> a écrit dans le message news: > [EMAIL PROTECTED] > > Have you tried replacing the + with %2B? > > > > Having never tried this before myself, this is sort of a shot in the dark > > ... but I figured it might give you an idea as to where to go from > > > > > > > Message-ID: <[EMAIL PROTECTED]> > > > To: [EMAIL PROTECTED] > > > From: "mmy" <[EMAIL PROTECTED]> > > > Date: Sun, 30 Mar 2003 11:30:22 +0200 > > > Subject: + character in a command line argument > > > > > > Hi! > > > > > > I'm using PHP 4.3.1, IE 5.5, Win ME > > > > > > I'm trying to use php through DOS command line. > > > > > > Running the very basic script > > > > > > $argv = $_SERVER['argv']; > > > var_dump($argv); > > > > > > I noticed that the command line arguments are split at a + character, > even > > > if between double quotes. > > > > > > for instance > > > > > > php test.php a+b > > > > > > or > > > > > > php test.php "a+b" > > > > > > both return 3 arguments, "test.php", "a" and "b". > > > > > > I don't know if it is a DOS or php problem (though if you name a file > > > a+b.txt, the DOS command type a+b.txt runs correctly, which seems to > > > exonerate DOS...). > > > > > > My questions are more practical : does anybody knows how to pass a + in > an > > > argument?? Are there other characters that are special in addition to " > > and > > > + ?? > > > > > > Thanks in advance > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php