Saying that the input "contains unicode" is not enough to understand the problem. Unicode can be conveyed in at least three different ways: UTF-16BE, UTF-16LE and UTF-8. The first two differ only in the byte-order of 16-bit "words" (in the computer science sense of "groupings of two bytes"), and both are substantially different from the third option.
When you say "lines with unicoding don't get output to a file", do you mean that some lines really are composed entirely of plain ASCII characters (and these get through just fine)? If so, then the data probably is UTF-8, because this encoding was designed so that ASCII characters, which are a small subset of Unicode, can be conveyed in their original single-byte form.
If you have Perl 5.8.x (hopefully, "x" is greater than 0), then it might be enough for you to check out the usage of the "-C" option when running perl (look it up with "perldoc perlrun") -- "-CS" means treat STDIN, STDOUT and STDERR as utf8-protocol file handles; "-CD" means treat any named files that are opened for input and output as having utf8-protocol.
You can also selectively apply utf8-protocol to specific file handles using "binmode( HANDLE, ":utf8" );" (in case you need the same script to also handle files that contain non-text binary data). Look that up with "perldoc perlunicode" in 5.8.x.
If your data are some other form of unicode, you'll probably want to use 5.8.x and the "Encode" module, to convert from the (external) UTF-16 form to (perl-internal) utf8 -- and back to UTF-16 if you want to keep that as your storage format.
If none of this helps, you'll need to post some code and sample data that demonstrate the problem you're having. |