Improve test case
[gammu.git] / include / gammu-unicode.h
blob98dabb2c16641521e73e1b84beeb17e05adfced3
1 /**
2 * \file gammu-unicode.h
3 * \author Michal Čihař
5 * Unicode manipulation functions.
6 */
7 #ifndef __gammu_unicode_h
8 #define __gammu_unicode_h
10 /**
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.
18 #include <wchar.h>
20 #include <gammu-types.h>
21 #include <gammu-config.h>
23 /**
24 * Returns length of unicode string.
26 * \ingroup Unicode
28 size_t UnicodeLength(const unsigned char *str);
30 /**
31 * Converts string to locale charset.
33 * \return Pointer to static string.
35 * \ingroup Unicode
37 char *DecodeUnicodeString(const unsigned char *src);
39 /**
40 * Converts string to console charset.
42 * \return Pointer to static string.
44 * \ingroup Unicode
46 char *DecodeUnicodeConsole(const unsigned char *src);
48 /**
49 * Converts string from unicode to local charset.
51 * \ingroup Unicode
53 void DecodeUnicode(const unsigned char *src, char *dest);
55 /**
56 * Encodes string from local charset to unicode.
58 * \ingroup Unicode
60 void EncodeUnicode(unsigned char *dest, const char *src, int len);
62 /**
63 * Decodes unicode file data with byte order mark (BOM).
65 * \ingroup Unicode
67 void ReadUnicodeFile(unsigned char *Dest, const unsigned char *Source);
69 /**
70 * Copies unicode string.
72 * \ingroup Unicode
74 void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source);
76 /**
77 * Encodes string to UTF-8 quoted printable.
79 * \ingroup Unicode
81 gboolean EncodeUTF8QuotedPrintable(char *dest, const unsigned char *src);
83 /**
84 * Decodes UTF-8 quoted printable string.
86 * \ingroup Unicode
88 void DecodeUTF8QuotedPrintable(unsigned char *dest, const char *src,
89 int len);
90 /**
91 * Encodes string to UTF-8.
93 * \ingroup Unicode
95 int EncodeWithUTF8Alphabet(unsigned char mychar1, unsigned char mychar2,
96 char *ret);
97 /**
98 * Decodes string from UTF-8.
100 * \ingroup Unicode
102 int DecodeWithUTF8Alphabet(const unsigned char *src, wchar_t * dest, int len);
105 * Decodes string from hex quoted unicode.
107 * \ingroup Unicode
109 void DecodeHexUnicode(unsigned char *dest, const char *src, size_t len);
112 * Encodes string to hex quoted unicode.
114 * \ingroup Unicode
116 void EncodeHexUnicode(char *dest, const unsigned char *src, size_t len);
119 * Compares two unicode strings.
121 * \ingroup Unicode
123 gboolean mywstrncmp(unsigned const char *a, unsigned const char *b, int num);
126 * Locates unicode substring.
128 * \ingroup Unicode
130 unsigned char *mywstrstr(unsigned const char *haystack,
131 unsigned const char *needle);
134 * Compares two unicode strings case insensitive.
136 * \ingroup Unicode
138 gboolean mywstrncasecmp(unsigned const char *a, unsigned const char *b, int num);
141 * Encode text to UTF-8.
143 * \ingroup Unicode
145 gboolean EncodeUTF8(char *dest, const unsigned char *src);
148 * Decode text from UTF-8.
150 * \ingroup Unicode
152 void DecodeUTF8(unsigned char *dest, const char *src, int len);
155 * Decode hex encoded binary text.
157 * \ingroup Unicode
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);
170 #endif
172 /* Editor configuration
173 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: