mhonarc-users

mhrcvars.pl::replace_li_var

1999-03-25 00:30:52
  `Check for clipping' (line 508) in mhrcvars.pl::replace_li_var has
some problems.
(The version of MHonArc is 2.3.3.)

First, < etc. are not treated correctly. (Already fixed?)
This is obviously bug because when the subject is
  Subject: >>>>>>>>>>>>>>>
then $len will ALWAYS be added by 45 (= (4 - 1) * 15).
As a result, $ret will be

  >>>>>>>>>>>>>&gt

though expected result is

  >>>>>>>>>>

when $SUBJECTNA:10$ specified.

This can be fixed with this patch.

========================================
--- mhrcvars.pl,orig    Mon Mar  1 15:59:31 1999
+++ mhrcvars.pl Thu Mar 25 14:02:15 1999
@@ -506,13 +506,8 @@
        }
 
        # Check for clipping
-       if ($len > 0 && $canclip) {
-           # Check for entity refs and modify clip length accordingly
-           foreach ($ret =~ /(\&[^;\s]*;)/g) {
-               $len += length($_) -1;
-           }
-           $ret = substr($ret, 0, $len);
-       }
+       $ret = join("", ($ret =~ /(\&[^;\s]*;|.)/g)[0 .. $len - 1])
+          if ($len > 0 && $canclip);
 
        # Check if JavaScript string
        $ret =~ s/(["'])/\\$1/g  if $jstr;
========================================


Again, this still have Japanese problem.

You know, strings of ISO-2022-JP can't be clipped straightforwardly,
e.g. when you want to shorten

| ESC $ B $ 3 $ s $ K $ A $ O ESC ( B   # KO-N-NI-CHI-WA, "hello" in Japanese
|         --- --- --- --- ---
|         KO  N   NI  CHI WA

to 4 char length string (i.e. $len = 4), it should be clipped as

| ESC $ B $ 3 $ s ESC ( B
|         --- ---
|         KO  N


I think it's not easy to solve this problem (at least with current
implementation) because $ret no longer has charset information.

Do you have any idea?

-- 
Takashi P.KATOH

<Prev in Thread] Current Thread [Next in Thread>
  • mhrcvars.pl::replace_li_var, Takashi P.KATOH <=