Re: Different OS, Different Line Break, Be a Little Problem
| From: | Helgi Þormar | Date: | Fri, 21 Jan 2005 18:28:47 +0000 |
| Subject: | Re: Different OS, Different Line Break, Be a Little Problem | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35667@lists.php.net to get a copy of this message | ||
On Fri, 2005-01-21 at 13:00, Firman Wandayandi wrote:
> Hi guys,
>
> I has a little problem with line break character, when i developing
> Contact_AddressBook, I tried to using different format of file,
> actually I used Windows (CRLF), Unix (LF) and Mac (CR).
> Contact_AddressBook use File_CSV (PEAR::File Package) to handling CSV
> file, when I sets the config 'crlf' = "\r\n" then I given Windows and
> Unix file format, everything fine, but when i given Mac format it
> doesn't working.
>
> PEAR.php, only defined OS_WINDOWS and OS_UNIX also PEAR_OS which the
> value is one of 'Windows' or 'Unix', I think, I able to resolve this
> problem if I know what the OS.
>
> My questions:
> 1. How to know what the OS, Windows/Unix/Mac family? Actually the
> problem is Mac, cause I can't testing there, I have no Mac OS :-D
> installed.
> 2. Does it needed to define OS_MAC and PEAR_OS = 'Mac' in PEAR.php?
If you look a the source for File_CSV then you see there is some issue
with the Mac EOL, http://www.php.net/fgets look at the lowest
note (not
user note btw.), this might be the reason :-)
Anyway I'm making a CSV package which is just CSV -> Array and via
versa, it's just kinda File_CSV with out the file part :-) Mostly the
same code to keep things a little BC, there I had no issues in making it
detect the right EOL and all, but since it was only from a string I
guess it doesn't count :-)
Dunno when I'll propose this, it's only a side project, have been busy
with other things in PEAR and professional wise but we'll see.
That said I don't know if it would help you anything to have that thing
in PEAR.php :-)
- Helgi