Changeset 3621:1116ed42fa23

Show
Ignore:
Timestamp:
2004-02-08 03:41:31 (5 years ago)
Author:
Edmund GRIMLEY EVANS <edmundo@…>
Branch:
HEAD
Message:

Fix a CP1255/8-related problem that's caused by a glibc/iconv bug.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • charset.c

    r3179 r3621  
    380380          continue; 
    381381      } 
    382       if (outrepl) 
     382      /* Replace the output */ 
     383      if (!outrepl) 
     384        outrepl = "?"; 
     385      iconv (cd, 0, 0, &ob, &obl); 
     386      if (obl) 
    383387      { 
    384         /* Try replacing the output */ 
    385388        int n = strlen (outrepl); 
    386         if (n <= obl) 
     389        if (n > obl) 
    387390        { 
    388           memcpy (ob, outrepl, n); 
    389           ++ib, --ibl; 
    390           ob += n, obl -= n; 
    391           ++ret; 
    392           continue; 
     391          outrepl = "?"; 
     392          n = 1; 
    393393        } 
     394        memcpy (ob, outrepl, n); 
     395        ++ib, --ibl; 
     396        ob += n, obl -= n; 
     397        ++ret; 
     398        iconv (cd, 0, 0, 0, 0); /* for good measure */ 
     399        continue; 
    394400      } 
    395401    }