2 * \file gammu-unicode.h
5 * Unicode manipulation functions.
7 #ifndef __gammu_unicode_h
8 #define __gammu_unicode_h
11 * \defgroup Unicode Unicode
12 * Unicode manipulation functions. Please note that most of functions
13 * here rely on initialised libc char conversions, what is usually done
14 * by locales initialisation. Recommended way for doing this is calling
15 * \ref GSM_InitLocales.
20 #include <gammu-types.h>
21 #include <gammu-config.h>
24 * Returns length of unicode string.
28 size_t UnicodeLength(const unsigned char *str
);
31 * Converts string to locale charset.
33 * \return Pointer to static string.
37 char *DecodeUnicodeString(const unsigned char *src
);
40 * Converts string to console charset.
42 * \return Pointer to static string.
46 char *DecodeUnicodeConsole(const unsigned char *src
);
49 * Converts string from unicode to local charset.
53 void DecodeUnicode(const unsigned char *src
, char *dest
);
56 * Encodes string from local charset to unicode.
60 void EncodeUnicode(unsigned char *dest
, const char *src
, int len
);
63 * Decodes unicode file data with byte order mark (BOM).
67 void ReadUnicodeFile(unsigned char *Dest
, const unsigned char *Source
);
70 * Copies unicode string.
74 void CopyUnicodeString(unsigned char *Dest
, const unsigned char *Source
);
77 * Encodes string to UTF-8 quoted printable.
81 gboolean
EncodeUTF8QuotedPrintable(char *dest
, const unsigned char *src
);
84 * Decodes UTF-8 quoted printable string.
88 void DecodeUTF8QuotedPrintable(unsigned char *dest
, const char *src
,
91 * Encodes string to UTF-8.
95 int EncodeWithUTF8Alphabet(unsigned char mychar1
, unsigned char mychar2
,
98 * Decodes string from UTF-8.
102 int DecodeWithUTF8Alphabet(const unsigned char *src
, wchar_t * dest
, int len
);
105 * Decodes string from hex quoted unicode.
109 void DecodeHexUnicode(unsigned char *dest
, const char *src
, size_t len
);
112 * Encodes string to hex quoted unicode.
116 void EncodeHexUnicode(char *dest
, const unsigned char *src
, size_t len
);
119 * Compares two unicode strings.
123 gboolean
mywstrncmp(unsigned const char *a
, unsigned const char *b
, int num
);
126 * Locates unicode substring.
130 unsigned char *mywstrstr(unsigned const char *haystack
,
131 unsigned const char *needle
);
134 * Compares two unicode strings case insensitive.
138 gboolean
mywstrncasecmp(unsigned const char *a
, unsigned const char *b
, int num
);
141 * Encode text to UTF-8.
145 gboolean
EncodeUTF8(char *dest
, const unsigned char *src
);
148 * Decode text from UTF-8.
152 void DecodeUTF8(unsigned char *dest
, const char *src
, int len
);
155 * Decode hex encoded binary text.
159 gboolean
DecodeHexBin(unsigned char *dest
, const unsigned char *src
, int len
);
162 * Converts single character from unicode to wchar_t.
164 int EncodeWithUnicodeAlphabet(const unsigned char *value
, wchar_t *dest
);
167 * Converts single character from wchar_t to unicode.
169 int DecodeWithUnicodeAlphabet(wchar_t value
, unsigned char *dest
);
172 /* Editor configuration
173 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: