UTF-8 conversion
"CHARBONNIER Christophe" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi list,
I'm trying to recode strings from UTF-8 to ISO-8859-1 charset, with this
little piece of code:
{
Octstr *body =
octstr_create("foo=100%25+des+%E9l%E9ments+%3D+%22%E7%22");
Octstr *body_final = NULL;
debug("test", 0, "body: %s", octstr_get_cstr(body));
debug("test", 0, "octstr_recode rc = %d",
octstr_recode(octstr_imm("iso-8859-1"), octstr_imm("utf-8"), body));
debug("test", 0, "body: %s", octstr_get_cstr(body));
debug("test", 0, "charset_from_utf8 rc = %d",
charset_from_utf8(body, &body_final, octstr_imm("iso-8859-1")));
debug("test", 0, "body_final: %s", octstr_get_cstr(body_final));
debug("test", 0, "charset_convert rc = %d", charset_convert(body,
"utf-8", "iso-8859-1"));
debug("test", 0, "body: %s", octstr_get_cstr(body));
}
But that doesn't look right.
The return-codes of octstr_recode, charset_from_utf8 and charset_convert
are 0 (means everything is right), but the string is not modified at
all...
Does anyboby can tell me what's wrong in my code ???
Thanxs in advance...
Christophe