From 4df80ec1b6fe317e211b5e2b310c3b3af4b219e5 Mon Sep 17 00:00:00 2001 From: robi Date: Sun, 6 Nov 2011 18:26:13 +0000 Subject: new:function for RPM + XCF ;change:TTF ZIP DEB Perl+Python and some other TXT --- src/util.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 4984794..c98a98a 100644 --- a/src/util.c +++ b/src/util.c @@ -660,3 +660,25 @@ int zero_space(unsigned char *buf, __u32 offset){ i++; return (i == end ) ? 1 : 0 ; } + +int is_unicode( unsigned char* buf){ + int ret = 0; + unsigned char *p = buf; + unsigned char *p1 = buf +1; + if ((*p > 0xc1) && (*p < 0xf5) && (*p1 > 0x7f) && (*p1 < 0xc0)){ + if (!(*p & 0x20)) + ret = 2; + else{ + p1++; + if ((!(*p & 0x10)) && (*p1 > 0x7f) && (*p1 < 0xc0)) + ret = 3 ; + else{ + p1++; + if ((!(*p & 0x08)) && (*p1 > 0x7f) && (*p1 < 0xc0)) + ret = 4 ; + } + } + } + return ret; +} + -- cgit v1.2.3