in reply to unreadable hash keys
You don't see the null bytes when using "more", because your terminal display ignores them.
If you show some code that demonstrates how this file was written, we could show you ways to avoid the problem. In the meantime, you might try passing that data file through a one-liner, like this:
But first you should follow the other advice given above: inspect the file more carefully with a hexdump tool, to confirm whether or not UTF-16 is being used regularly for every character in the file (not just the hash keys). If my guess is wrong, and only the hash keys are 16-bit characters, the script above would screw things up badly, and a slightly more complicated script would be needed to fix the file.perl -pe 'BEGIN{binmode STDIN,"encoding(UTF-16BE)"; binmode STDOUT,"ut +f8"}' < file.in > file.out
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: unreadable hash keys
by nujgnahz (Initiate) on Jun 06, 2008 at 17:05 UTC | |
by graff (Chancellor) on Jun 06, 2008 at 22:18 UTC |