Loading ...
Sorry, an error occurred while loading the content.

Re: [NTS] Perl 5.8 vs. Notetab

Expand Messages
  • Sheri
    ... Found a way to apply it to the last record only, but still interested in better ideas: if (eof && $] 5.006) { $badchar = chr(26); s/($badchar)$//; }
    Message 1 of 4 , Apr 3 9:44 AM
    • 0 Attachment
      At 11:01 AM 4/3/03 -0500, I wrote:

      >The best I've come up with so far is to add this inside to the "while (<>)" loop of each of my Perl scripts that are fed by ^!RunPerl or ^!RunScript:
      >
      >if ($] > 5.006) {
      > $badchar = chr(26);
      > s/($badchar)$//;
      >}
      >
      >But that way it runs on each input unit (e.g., line or paragraph) instead of just the last one (which would be more appropriate). I guess it doesn't matter, but I would like to know how to apply it to the last unit only.

      Found a way to apply it to the last record only, but still interested in better ideas:

      if (eof && $] > 5.006) {
      $badchar = chr(26);
      s/($badchar)$//;
      }

      Regards,
      Sheri
    • Grant MacKenzie
      I am not sure about this but think this is a problem to do with the Byte Order Mark (BOM) used in unicode in Perl 5.8 the Unicode model has completely
      Message 2 of 4 , Apr 7 12:19 PM
      • 0 Attachment
        I am not sure about this but think this is a problem to do with the Byte
        Order Mark (BOM) used in unicode

        "in Perl 5.8 the Unicode model has completely changed: now the
        ``Unicodeness'' is bound to the data itself,"
        REF: perl documentation

        When using the WSH stdin stdOut i also ran into this so I do a regEx on the
        read stream.

        var stdin = WScript.StdIn;
        var stdout = WScript.StdOut;
        var inStr = stdin.ReadAll();
        inStr = inStr.replace(//g, " ");

        The box thing as I understand it a way MS deals with an unrecognised
        character.
        If you have got spare time on your hands you might want to look at.
        A tutorial on character code issues
        http://www.cs.tut.fi/%7Ejkorpela/chars.html




        > >>>00001 one
        > >00002 two
        > >00003 three
        > >00004 four
        > >00005 five
        > >00006 six<<
        > >
        > >Is that what you're talking about?
        >
        > Yes that's it. If you select the character and run this clip
        > command on it, it reports it is a decimal character 26.
        >
        > ^!Info ^$ChartoDec(^$GetSelection$)$
        >
        > I did some research and found out this is the same character
        > MS-DOS uses as an end-of-file mark (Ctrl-Z).
        >
        > It doesn't necessarily come back as the last character printed to
        > Notetab, e.g., a reverse sort in Perl will put it at the top. So
        > its a character that really needs to be removed from Perl's
        > standard input buffer. I don't know how to do that.
        >
        > Also Notetab Replace clip commands won't remove it from the
        > output (although the Replace dialog will).
        >
        > The best I've come up with so far is to add this inside to the
        > "while (<>)" loop of each of my Perl scripts that are fed by
        > ^!RunPerl or ^!RunScript:
        >
        > if ($] > 5.006) {
        > $badchar = chr(26);
        > s/($badchar)$//;
        > }
        >
        > But that way it runs on each input unit (e.g., line or paragraph)
        > instead of just the last one (which would be more appropriate).
        > I guess it doesn't matter, but I would like to know how to apply
        > it to the last unit only.
        >
        > Or if there is some better way to approach it that wouldn't
        > require changing each script or clip.
        >
        > Any ideas?
        >
        > Regards,
        > Sheri
        >
        >
        >
        > ntb-scripts-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.