Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: simple file question, extra spaces, win32

by rkg (Hermit)
on Dec 29, 2003 at 18:57 UTC ( #317503=note: print w/replies, xml ) Need Help??

in reply to simple file question, extra spaces, win32

I see
| ■U R L R e p o r t |
and those spaces are ascii zero, not spaces, it seems
local $, = ' '; print map { ord $_ } split //, $row;
255 254 85 0 82 0 76 0 32 0 82 0 101 0 112 0 111 0 114 0 116 0
I will look into the Unicode module...

Thanks for the tip about the moon -- I knew this whole problem involved aliens. At least it isn't the Black Helicopters -- those are very scary.

Replies are listed 'Best First'.
Re: Re: simple file question, extra spaces, win32
by SavannahLion (Pilgrim) on Dec 29, 2003 at 19:31 UTC
    Just so you know, the first two bytes (255 254) is a FFFE byte code marker for unicode. It tells whatever is reading the file that it's a Unicode file and what order the bytes are in. For example, if it was FEFF then it would be in Big Endian order where the sequence of 0's would be reversed.

    Example: 254 255 0 85 0 82 0 76....

    I was guessing as to what the problem was without looking at the actual file, but since you posted a tidbit from the file, here's a Unicode FAQ, that should help you to understand how Unicode works.

    Is it fair to stick a link to my site here?

    Thanks for you patience.

Re: Re: simple file question, extra spaces, win32
by ysth (Canon) on Dec 30, 2003 at 03:12 UTC
    What you want is not the Unicode module (is there one?) but the Encode module:
    use Encode; $utf16_row = v255.; # fake up your data. $utf8_row = decode("utf16", $utf16_row); print $utf8_row;

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2023-06-06 10:01 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (26 votes). Check out past polls.