I just switch to a new server that runs redhat 8 and perl 5.8....
I am reading a file into $buf using
while(read(filehandle,$buf,60*57){
$unf .=encode_base64($buf);
}
This has worked fine for me in the past... as 57 bytes is
equal to one line of base64 code...
But now i keep getting Wide Characters in Subroutine and
perl dies.
Now i created a smaller script....
#!/usr/bin/perl
use MIME::Base64;
$imgpath = "/home/freexxxm/public_htmlews_photos";
# Ed. - rot13ed to make firewall safe
$cat="Nany-Frk";
open (LOG, ">> log2");
opendir (DM, "/home/usr/public_htmlews_photos") or print "$today <b>E
+RROR</b> couldn't get contents of <br>dir $!\n" ;<br>
@files=grep { /\.jpg/ } readdir(DM);
closedir(DM);
$img=$files[rand(@files)];
while ($seen){$img++};
$img;
print "$img $!\n";
open(FILE, "$imgpath/099.jpg") or print LOG "$today <b>ERROR</b> openi
+ng image while posting $!\n";<br>
while (read(FILE, $buf, 60*57)) {
print LOG"$buf$!";
$unf .=encode_base64($buf);
}
print "$unf";
close FILE;
close LOG;
I have run this 2 way one way i just looked at the print
out of $buf which dies partiall thru with "Malformed
Uft-8 character" and ive run it the way the code
shows now ... and the encode_base64 give me the
same "Wide Character in subroutine" error. Please
could someone explain what this is and whats causing
it ... and how to fix this....
update (broquaint): added formatting and rot13ed the contents of $cat for naive firewalls
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.