ICU-3019 add dectetion of UTF-EBCDIC signature

X-SVN-Rev: 16027
This commit is contained in:
Ram Viswanadha 2004-07-16 21:48:33 +00:00
parent ffc6e513ad
commit faa56bc083
2 changed files with 10 additions and 2 deletions

View File

@ -2424,8 +2424,12 @@ ucnv_detectUnicodeSignature( const char* source,
*signatureLength=4;
return "UTF-7";
}
}else if(start[0]=='\xDD' && start[1]== '\x73'&& start[2]=='\x66' && start[3]=='\x73'){
*signatureLength=4;
return "UTF-EBCDIC";
}
/* no known Unicode signature byte sequence recognized */
*signatureLength=0;
return NULL;

View File

@ -1469,7 +1469,9 @@ TestSignatureDetection(){
"\x2B\x2F\x76\x38\x41", /* UTF-7 */
"\x2B\x2F\x76\x39\x41", /* UTF-7 */
"\x2B\x2F\x76\x2B\x41", /* UTF-7 */
"\x2B\x2F\x76\x2F\x41" /* UTF-7 */
"\x2B\x2F\x76\x2F\x41", /* UTF-7 */
"\xDD\x73\x66\x73" /* UTF-EBCDIC */
};
static const char* expected[] = {
"UTF-16BE",
@ -1491,7 +1493,8 @@ TestSignatureDetection(){
"UTF-7",
"UTF-7",
"UTF-7",
"UTF-7"
"UTF-7",
"UTF-EBCDIC"
};
static const int32_t expectedLength[] ={
2,
@ -1513,6 +1516,7 @@ TestSignatureDetection(){
4,
4,
4,
4,
4
};
int i=0;