All Unicode characters are 16 bits wide (well, not strictly
true...), but have a large variety of encodings. In UTF-8, for
instance, the ASCII characters are encoded exactly the same
way, so newline is, er, \n. UTF-7 is just plain silly, and
UTF-16 is 16-bits wide, so newline would be \0\n.
(Note that the first 256 characters of Unicode are the
ISO-8859-1, character set, better known as Latin-1. The
first 128 are ASCII)
There again, in NT, text files are plain 8-bit ASCII (with
the top-bit set characters being some godawful M$ encoding),
so \r\n should indeed do the trick, unless you really
are using some form of Unicode editor & file format.
(Perl was written for Unix, where newline is just \n, but
NT considers newline to be \r\n. Actually, only notepad
seems to think that these days...)
Andrew. | [reply] |
yeah. windows thinks of a newline differently than unix, which thinks differently than macs. I found this out when dealing with webservers on different platforms.I wanted to split the return from a web request into the header and the http data.( the header
is separated from the data by two newlines). So in order to make this work cross platform, i had to use this:
my ($header , $data) = split (/\n\n|\r\n\r\n|\r\r/ , $result, 2);
this handles unix newlines, \r\n (windows newline), and \r for the macs. | [reply] [d/l] |
I've never used it, but I think that Unicode::Map might solve your problem. Check the read me. You'll also have to install Startup.pm (it's at the same link). | [reply] |