Re: parsing Nero .nri file -- possible character set issues (perl newbie)

From: m (mpepple_at_hotmail.com)
Date: 01/14/04


Date: 14 Jan 2004 09:07:30 -0800

Simon Taylor <simon@unisolve.com.au> wrote in message news:<bu27iu$4he$1@otis.netspace.net.au>...
> Hello Matt,
>
> > redhat 7.2, perl 5.6.1
> >
> > am trying to extract filenames from Nero .nri file, which has quite a
> > bit of extra, strange characters.
>
> It would help if you could submit a (small) sample of the data you're
> trying to parse, along with the code that you're currently using.
>
> There are a lot of very clever people reading this list, but you have to
> help them as much as you can to increase your chances of getting a
> useful answer.
>
> > anytime i try to open the source .nri file with a perl script, it
> > outputs all sorts of crazy talk and changes my prompt's characters to
> > crazy characters,
>
> Is this really what's happening, or is it more accurate to say that the
> screen corruption occurs when you *display* the contents of the .nri
> file, (and not when you merely open it, as you've implied)?
>
> I hope this helps a little. I look forward to seeing a follow up post
> from you.
>
> Regards,
>
> Simon Taylor

Simon-

Thanks for the response. I tried pasting a portion of the nri file
into this window but it doesn't seem to like that. the whole file is
here: http://mattpepple.com/nero/cg36.zip (6k).

i can pico the nri file, but barely anything displays (maybe 15
characters). i can less the file and it shows all sorts of weirdness,
which i touched on in the original post. none of this has any effect
on the crazy character/screen corruption--that does not occur until i
try to open the file with my perl script.

### begin code sample
open (INFILE, "$curfile") || die "couldn't open $curfile";
open (OUTFILE,">> $destXml") || die "couldn't open $destXml\n";
while ($input = <INFILE>) {
  unless ($input =~ /.mp3\s|.ogg\s|.wav\s|.mp4\s|.mp2\s|.wma\s/i)
{next};
  $input =~ s/![a-zA-Z0-9-_\s]//;
  $filename = substr $input, 60;
  foreach $filetype (@filetypes) {
# @filetypes is a list similar to that from line 4: .mp3, .ogg, etc..
    $eofname = rindex($input, $filetype);
    if ($eofname > 0) {last};
  }
  $filename = substr($filename, 0, $eofname);
  $format = substr($filename,-3,3);
### end code sample

i know line 5 ($input =~ s/![a-zA-Z0-9}//;) doesn't do what i
intended. my thought was to put that in a 'while' control structure
and eliminate any occurrences of non [a-zA-Z0-9\s-_] characters.
other than line 5--which was inserted to handle the nri file's weird
characters--the rest of the script does pretty much what i need it to
when tested against a file i made in pico.

if any more info is needed, jus let me know. i very much appreciate
any help you can offer.

matt



Relevant Pages

  • Re: parsing Nero .nri file -- possible character set issues (perl newbie)
    ... > am trying to extract filenames from Nero .nri file, ... > bit of extra, strange characters. ...
    (comp.lang.perl.misc)
  • Re: MYSQL - ADO Insert problem - Help please
    ... I agree with Matt. ... >>"Text12345" (9 characters) ... >>If the biggest entry is 20 characters long, it will be truncated to 20. ... > Just a shot in the dark, but what are your MyODBC connect options? ...
    (borland.public.delphi.database.ado)
  • Re: Spoiler Sunday
    ... Take David coming in to Matt's to have a drink and a chat last week. ... Matt shopped David after faling to blackmail him over the dead ... If, in any soap opera, characters who had serious disagreements at some point never spoke to each other again then it would pretty much bring the whole thing to a halt. ... It's difficult to imagine there is any pair of people who haven't fallen got reason to speak to each other ever again. ...
    (uk.media.radio.archers)
  • Re: Removing Date and Time
    ... Outstanding! ... Thanks, Matt. ... I figured was the number of characters too and tried changing ... Prev by Date: ...
    (comp.periphs.scanners)
  • Re: Studio 60 on the Cancelled Strip
    ... stress over every aspect of their careers. ... characters. ... latter doctors were highly-paid pompous jackasses. ... If this were the MacLuhan Age, I'd say most of the cast was cool, while Matt ...
    (rec.arts.tv)