+
+ default:
+ // we have at least 4 characters so we may finally decide whether
+ // we have a BOM or not
+ if ( src[0] == '\xEF' && src[1] == '\xBB' && src[2] == '\xBF' )
+ return BOM_UTF8;
+
+ if ( src[0] == '\x00' && src[1] == '\x00' &&
+ src[2] == '\xFE' && src[3] == '\xFF' )
+ return BOM_UTF32BE;
+
+ if ( src[0] == '\xFF' && src[1] == '\xFE' &&
+ src[2] == '\x00' && src[3] == '\x00' )
+ return BOM_UTF32LE;
+
+ if ( src[0] == '\xFE' && src[1] == '\xFF' )
+ return BOM_UTF16BE;
+
+ if ( src[0] == '\xFF' && src[1] == '\xFE' )
+ return BOM_UTF16LE;