From faa56bc083e7b7a39048a7942aed19f8f9d52852 Mon Sep 17 00:00:00 2001 From: Ram Viswanadha Date: Fri, 16 Jul 2004 21:48:33 +0000 Subject: [PATCH] ICU-3019 add dectetion of UTF-EBCDIC signature X-SVN-Rev: 16027 --- icu4c/source/common/ucnv.c | 4 ++++ icu4c/source/test/cintltst/nucnvtst.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/icu4c/source/common/ucnv.c b/icu4c/source/common/ucnv.c index c4366bd748a..eaf7079812e 100644 --- a/icu4c/source/common/ucnv.c +++ b/icu4c/source/common/ucnv.c @@ -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; diff --git a/icu4c/source/test/cintltst/nucnvtst.c b/icu4c/source/test/cintltst/nucnvtst.c index 69431c1a86c..130f95ce2a3 100644 --- a/icu4c/source/test/cintltst/nucnvtst.c +++ b/icu4c/source/test/cintltst/nucnvtst.c @@ -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;