Hi,

the scriptlet

   export LANG="ja_JP.SJIS"
   # Multi byte character \0201[
   b=[
   echo $b
   echo "$b"

produces broken output for `"$b"' but not for `$b'.  The
attached patch should fix this problem.


     Werner

-- 
 Dr. Werner Fink <[EMAIL PROTECTED]>
 SuSE LINUX Products GmbH,  Maxfeldstrasse 5,  Nuernberg,  Germany
 GF: Markus Rex,  HRB 16746 (AG Nuernberg)
 phone: +49-911-740-53-0,  fax: +49-911-3206727,  www.opensuse.org
------------------------------------------------------------------
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
--- src/cmd/ksh93/sh/macro.c
+++ src/cmd/ksh93/sh/macro.c    2007-11-16 14:07:24.000000000 +0000
@@ -1867,6 +1867,12 @@ static void comsubst(Mac_t *mp,int type)
        return;
 }
 
+#if SHOPT_MULTIBYTE
+#define ismbdig(c)     ((state[*(unsigned 
char*)(c)]==S_DIG)&&(!mbwide()||(mbsize(c)<2)))
+#else
+#define ismbdig(c)     (state[*(unsigned char*)(c)]==S_DIG)
+#endif
+
 /*
  * copy <str> onto the stack
  */
@@ -1892,6 +1898,15 @@ static void mac_copy(register Mac_t *mp,
                /* insert \ before file expansion characters */
                while(size-->0)
                {
+#if SHOPT_MULTIBYTE
+                       if(mbwide())
+                       {       ssize_t len = mbsize(cp);
+                               if (len > 1)
+                               {       cp += len;
+                                       continue;
+                               }
+                       }
+#endif /* SHOPT_MULTIBYTE */
                        c = state[n= *(unsigned char*)cp++];
                        if(nopat&&(c==S_PAT||c==S_ESC||c==S_BRACT||c==S_ENDCH) 
&& mp->pattern!=3)
                                c=1;
@@ -1899,7 +1914,7 @@ static void mac_copy(register Mac_t *mp,
                                c=1;
                        else if(mp->pattern==2 && c==S_SLASH)
                                c=1;
-                       else if(mp->pattern==3 && c==S_ESC && (state[*(unsigned 
char*)cp]==S_DIG||(*cp==ESCAPE)))
+                       else if(mp->pattern==3 && c==S_ESC && 
(ismbdig(cp)||(*cp==ESCAPE)))
                        {
                                if(!(c=mp->quote))
                                        cp++;
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to