Mercurial > audlegacy
comparison src/libguess/arabic_impl.c @ 3206:6bcfc6561711 trunk
Implement support for Arabic and Turkish.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Wed, 01 Aug 2007 08:08:13 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3202:e9f66c3905ec | 3206:6bcfc6561711 |
---|---|
1 #include "libguess.h" | |
2 | |
3 static const char *_guess_ar(const unsigned char *ptr, int size) | |
4 { | |
5 int i; | |
6 | |
7 for (i = 0; i < size; i++) | |
8 { | |
9 if ((ptr[i] >= 0x80 && ptr[i] <= 0x9F) || | |
10 ptr[i] == 0xA1 || ptr[i] == 0xA2 || ptr[i] == 0xA3 || | |
11 (ptr[i] >= 0xA5 && ptr[i] <= 0xAB) || | |
12 (ptr[i] >= 0xAE && ptr[i] <= 0xBA) || | |
13 ptr[i] == 0xBC || ptr[i] == 0xBD || | |
14 ptr[i] == 0xBE || ptr[i] == 0xC0 || | |
15 (ptr[i] >= 0xDB && ptr[i] <= 0xDF) || (ptr[i] >= 0xF3)) | |
16 return "CP1256"; | |
17 } | |
18 | |
19 return "ISO-8859-6"; | |
20 } | |
21 | |
22 const char *guess_ar(const char *ptr, int size) | |
23 { | |
24 if (dfa_validate_utf8(ptr, size)) | |
25 return "UTF-8"; | |
26 | |
27 return _guess_ar((const unsigned char *)ptr, size); | |
28 } |