FireBirdLib - Topfield TMS PVR TAP Programming Library
GetStringEncoding.c
Go to the documentation of this file.
1#include <string.h>
2#include "libFireBird.h"
3
4void GetStringEncoding(const char *Text, bool *hasAnsiChars, bool *hasUTFChars)
5{
7
8 byte *p, *pEnd;
9 byte BytesPerChar;
10 bool AC, UC;
11
12 AC = FALSE;
13 UC = FALSE;
14 if(Text && Text[0])
15 {
16 p = SkipCharTableBytes(Text);
17 pEnd = p + strlen(p);
18
19 while(p < pEnd)
20 {
21 UC |= isUTF8Char(p, &BytesPerChar);
22 if((*p >= 0xa0) && (BytesPerChar == 1)) AC = TRUE;
23 p += BytesPerChar;
24 }
25 }
26
27 if(hasAnsiChars) *hasAnsiChars = AC;
28 if(hasUTFChars) *hasUTFChars = UC;
29
30 TRACEEXIT();
31}
void GetStringEncoding(const char *Text, bool *hasAnsiChars, bool *hasUTFChars)
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243
byte * SkipCharTableBytes(const byte *p)
bool isUTF8Char(const byte *p, byte *BytesPerChar)
Definition: isUTF8Char.c:3