annotate src/libguess/greek_impl.c @ 3215:ce2d24746c09 trunk

Add support for greek and hebrew character set detection.
author William Pitcock <nenolod@atheme-project.org>
date Thu, 02 Aug 2007 02:00:21 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3215
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
1 static const char *_guess_gr(const unsigned char *ptr, int size)
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
2 {
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
3 int i;
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
4
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
5 for (i = 0; i < size; i++)
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
6 {
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
7 if (ptr[i] == 0x80 ||
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
8 (ptr[i] >= 0x82 && ptr[i] <= 0x87) ||
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
9 ptr[i] == 0x89 || ptr[i] == 0x8B ||
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
10 (ptr[i] >= 0x91 && ptr[i] <= 0x97) ||
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
11 ptr[i] == 0x99 || ptr[i] == 0x9B || ptr[i] == 0xA4 ||
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
12 ptr[i] == 0xA5 || ptr[i] == 0xAE)
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
13 return "CP1253";
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
14 }
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
15
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
16 return "ISO-8859-7";
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
17 }
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
18
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
19 const char *guess_gr(const char *ptr, int size)
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
20 {
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
21 return _guess_gr((const unsigned char *) ptr, size);
ce2d24746c09 Add support for greek and hebrew character set detection.
William Pitcock <nenolod@atheme-project.org>
parents:
diff changeset
22 }