Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Remove Double Spacing

by theorbtwo (Prior)
on Jan 28, 2005 at 19:07 UTC ( [id://426079]=note: print w/replies, xml ) Need Help??


in reply to Remove Double Spacing

Are you sure those are really spaces, and not null bytes? (Try asking Data::Dumper to dump it.)

If those are null bytes, the file is in UTF-16, and you're reading it as if it were in latin-1. If you're using perl 5.8, you can simply tell Perl that the file is in utf16: binmode($fh, ':encoding(utf-16)'). If you're under 5.6, it's a hair more complicated -- you need to first read in the data, then use Encode to "decode" it from utf-16 to perl's internal format. $useable=decode('utf-16', $encoded);.


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://426079]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-26 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found