Changeset 9b9d9a in git


Ignore:
Timestamp:
May 15, 2015, 5:01:42 PM (9 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
6d92ca60084db0a93a4b9681fc0de288e4c400e2
Parents:
e2bc4c7024f5a134fa3019b58a1dcd11b9c9e2b1
Message:
check for utf16/utf8 prefix
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/mod_lib.cc

    re2bc4c r9b9d9a  
    22
    33#include <resources/feFopen.h>
     4#include <reporter/reporter.h>
    45#include <polys/mod_raw.h>
    56
     
    3132  const unsigned char mach_FAT[]={0xca,0xfe,0xba,0xbe,0};
    3233  const unsigned char mach_fat[]={0xbe,0xba,0xfe,0xca,0};
     34
     35  const unsigned char utf16be[]={0xfe,0xff,0};
     36  const unsigned char utf16le[]={0xff,0xfe,0};
     37  const unsigned char utf8ms[]={0xEF,0xBB,0xBF,0};
    3338
    3439  int i=0;
     
    113118    goto lib_type_end;
    114119  }
     120  if ((strncmp(buf,(const char *)utf16be,2)==0)
     121  ||(strncmp(buf,(const char *)utf16le,2)==0))
     122  {
     123    WerrorS("UTF-16 not supported");
     124    LT=LT_NOTFOUND;
     125    goto lib_type_end;
     126  }
     127  if (strncmp(buf,(const char *)utf8ms,3)==0)
     128  {
     129    WarnS("UTF-8 detected - may not work");
     130    LT=LT_SINGULAR;
     131    goto lib_type_end;
     132  }
    115133  if(isprint(buf[0]) || buf[0]=='\n')
    116134  { LT = LT_SINGULAR; goto lib_type_end; }
Note: See TracChangeset for help on using the changeset viewer.