Subject: [Imap-uw] Using utf8_text

From: Stefan Schulte <[email-masked]>
Date: Wed, 18 May 2005 17:57:18 +0200

Hi all,

i have problems in using the function utf8_text to convert a
text in iso-8859-1 format to utf-8. Can anybody tell me
how I have to correct my example code ?
If i print the result I get the converted utf-8 plus some
undefined characters.

Many thanks
Stefan

----------------- source ------------------------

SIZEDTEXT source;
SIZEDTEXT dest;

char* text = (char*) malloc (8);
memset(text, 0x0,8);
strcpy(text, "Fußball");

source.data = (unsigned char*) text;
source.size = strlen(text);

utf8_text(&source, "iso-8859-1", &dest, NIL);
_______________________________________________
Imap-uw mailing list
[email-masked]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

---

From: Mark Crispin <[email-masked]>
Date: Wed, 18 May 2005 09:03:47 -0700 (PDT)

> If i print the result I get the converted utf-8 plus some

The string is not null-terminated.  You have to use the count to indicate 
the end of the string.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.
_______________________________________________
Imap-uw mailing list
[email-masked]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw