comparison mcabber/src/utf8.c @ 49:18a03a69f5e4

[/trunk] Changeset 65 by mikael * Same change to utf_decode (useless I think... but maybe cleaner).
author mikael
date Wed, 06 Apr 2005 10:23:45 +0000
parents f937475e9baa
children 1bc374915787 33b8e801ffa6
comparison
equal deleted inserted replaced
48:f937475e9baa 49:18a03a69f5e4
12 * Note: it is up to the caller to free the returned string 12 * Note: it is up to the caller to free the returned string
13 */ 13 */
14 char *utf8_decode(const char *src) 14 char *utf8_decode(const char *src)
15 { 15 {
16 char *ret = calloc(1, strlen(src) + 1); 16 char *ret = calloc(1, strlen(src) + 1);
17 char *aux = ret; 17 unsigned char *aux = (unsigned char*)ret;
18 18
19 while (*src) { 19 while (*src) {
20 unsigned char lead = *src++; 20 unsigned char lead = *src++;
21 if ((lead & 0xe0) == 0xc0) { 21 if ((lead & 0xe0) == 0xc0) {
22 unsigned char ch2 = *src++; 22 unsigned char ch2 = *src++;