procmail
[Top] [All Lists]

Re^4: Condition with BODY length?

1997-07-24 03:14:00
Philip Guenther <guenther(_at_)gac(_dot_)edu> wrote:

Philip> Oog.  Multibyte characters are nasty.  Is the pager limit 100 bytes, or
Philip> a 100 characters?  Does your pager even understand multibyte
Philip> characters, or do them come through as goblygook?

Pager limit is 100 bytes. Not 100 characters.
In other words, it could display 50 chars of 2-byte-code or
100 chars of 1-byte-code or any number of chars in between for
1-byte-code & 2-byte-code-mixed-messages.

My pager does understand Japanese 2-byte chars (pretty expensive though)
and fundamentally does not garble them unless you send 
sencond byte of 2-byte char at the begining of message,
in which case, all the chars till certain char(?)
in the message get garbled.

Philip> >I heard substr in jperl does not support two-byte char but split does.
Philip> >Anyway, I prefer to solve it using "domestic" perl by
Philip> >probably comparing the last byte with char-code-range and ......
Philip> 
Philip> Hmm, it sounds like jperl supports multibyte characters with regexps
Philip> searchs, in which case you may be able to replace the substr() calls
Philip> above with something like:
Philip> 
Philip>         s/^(.{,100})//;
Philip>         print "$1\n";

For this, you are assuming my pager limit is 100 chars and not 100 bytes.
Am I correct?

Philip> With a non-multibyte aware perl you would be best off building the 
string
Philip> to sent byte by byte, keeping track of how many actual characters you've
Philip> gotten so far and quiting when that hits your limit.

Rather, I am thinking of just checking the 100th byte and 101th byte, 
or the border bytes, if code-range-wise-feasible.
if (100th+101th)bytes is within certain range, say x0208-1983,
cut the current message to 99 bytes and 
place the two bytes in top of next message.
Do you think it's feasible in one-byte-perl?

Philip> When it doubt, check the manpage (procmailsc(5)):
<snip>
Philip> With w=x=L=1, you get
Philip> 
Philip>         1*(M/1)^1 == M

Thanks. Now at least I know what it means:->
_/_/_/      Mitsuru FURUKAWA      _/_/_/
_/_/_/        Tokyo, Japan        _/_/_/
_/_/_/     mailto:furu(_at_)009(_dot_)com    _/_/_/
_/_/_/  http://www.009.com/furu/  _/_/_/