Hi Daniel,attached is a little C program, which is, what my application does. It runs well on my Debian box and fails on the Fedora machine.
I compiled the code with: # gcc -I/usr/include/libxml2 -lxml2 -o xmltest xmltest.c On Fedora, the little program exits with the message: bad encoding result: 0 I hope that is of some use. :-) Harry--On Tuesday, September 27, 2005 10:37:07 AM -0400 Daniel Veillard <[EMAIL PROTECTED]> wrote:
On Tue, Sep 27, 2005 at 04:06:19PM +0200, [EMAIL PROTECTED] wrote:and the input() procedure always returns 0, whatever I try to encode. I am also catching all return codes along the way but all seems to be ok. :-/ I can not find anything wrong with the code since it behaves well on other systems. Unfortunately I don't get any error message along the way, so I am kinda out of ideas what might be wrong. Can somebody give me a little hint where to look for the problem?not without a complete standalone program and an explanation of what is going wrong: standalone -> so I or other can reproduce what you are doing explanation -> what is wrong so we can look at it Daniel
-- 1024D/40F14012 18F3 736A 4080 303C E61E 2E72 7E05 1F6E 40F1 4012 -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GIT/S dx s: a C++ ULS++++$ P+++ L+++$ !E W++ N+ o? K? !w !O !M V PS+ PE Y? PGP+++ t+ 5-- X+ R+ !tv b++ DI++ D+ G e* h r++ y++ ------END GEEK CODE BLOCK------
#include <stdio.h>
#include <string.h>
#include <libxml/xmlversion.h>
#include <libxml/encoding.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
int main(int argc, char **argv)
{
const char* instring = "my teststring";
xmlCharEncodingHandler* encodingHandler = NULL;
xmlCharEncoding encoder;
int insize,
outsize,
ret,
tmp;
char* convertbuffer = NULL;
encoder = xmlParseCharEncoding("ISO-8859-1");
if (encoder <= 0)
{
fprintf(stderr, "no encoder\n");
return 1;
}
encodingHandler = xmlGetCharEncodingHandler(encoder);
if (!encodingHandler)
{
fprintf(stderr, "no encodingHandler\n");
return 1;
}
insize = strlen((char*)instring) + 1;
outsize = insize * 2 - 1;
convertbuffer = malloc(outsize);
tmp = insize - 1;
ret = encodingHandler -> input(
(unsigned char*)convertbuffer, &outsize,
(unsigned char*)instring, &tmp);
if (ret <= 0 || tmp != insize - 1)
{
fprintf(stderr, "bad encoding result: %d\n", ret);
return 1;
}
free(convertbuffer);
xmlCharEncCloseFunc(encodingHandler);
return 0;
}
pgpPRGhy6uB2b.pgp
Description: PGP signature
_______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
