Re: Converting codepages to UTF8



Dr.Ruud wrote:
P schreef:

#!/usr/bin/perl
use warnings;
use strict;

I think you need this:

use Encode qw(cp437 cp850 cp852);


But those are just arguments to the decode() subroutine. They aren't
exported by Encode.pm so that gives errors.


or maybe

use Encode::Byte;


According to the documentation for Encode::Byte decode()
loads Encode::Byte implicitly.


but see also the remarks about PerlIO in `perldoc Encode`.


Those remarks only show of a way to do the encoding on-the-fly.
The result is exactly the same, though.


opendir(DIR, '.') or die "Can't open input directory: $!";

Alternative:

opendir my $dir, '.'
or die "Can't open input directory: $!";

my %files = map { $_ => 1 } grep { $_ !~ m/^\.\.?$/ } readdir(DIR);


Maybe:

my %files = map { $_ => 1 } grep { ! m/\A\.\.?\z/s } readdir $dir;

or:

my %files = map { $_ => 1 } grep -f, readdir $dir;


These tips don't address the issue, though.


Thanks anyway.


--
Best regards,
Angela Druss

.



Relevant Pages

  • Re: Need a bit of information about Compression
    ... either encode a full length, or a length mod some constant. ... Yes, full Length coding, arithmetic coding which is certainly better ... if you are decoding, say, 1024 symbols, then you stop as soon as you decode ... less common is to set up some special condition, where the eof is ...
    (comp.compression)
  • Re: Sending floats over a client-server in Smalltalk
    ... The trick is knowing what to decode them ... Then encode the number in the remaining bytes. ... ByteString>>floatAt: byteIndex ... I could then take a string ...
    (comp.lang.smalltalk)
  • Re: How to flip a coin over e-mail?
    ... >between these outcomes. ... You encode the room descriptions with your key A, coding each entry ... there's one entry left on the list which you can decode to ...
    (sci.math)
  • Re: unicode and hashlib
    ... Of course my dyslexia sticks out here as I get encode and decode exactly ... Characters are "encoded" to a byte format. ... You decode from on character set to a unicode object ...
    (comp.lang.python)
  • CBF file encryption, some questions
    ... key or something before encoding plaintext so the first block of the cipher ... Basically my question is if the first block is encoded ... Forexample if I appended a string "DECODE OK!" ... random key and encode the file (assuming the RNG has a sequencegreater than ...
    (sci.crypt)