I don't think it's an xml problem, I think it's a printf issue.
Instead of: printf(bufptr);
Use: printf("%s", bufptr);
Since your bufptr contains % characters, the characters after it have
special meanings. For example %d means print integer, %s means print
string ... this is standard C stuff. If you want to print the string as
is, use printf("%s", bufptr);
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 26, 2005 5:36 AM
> To: [email protected]
> Cc: [email protected]
> Subject: [xml] Encoding
>
>
> Hi all,
> I'm seeing a strange error which I can't understand.
> I'm writing a C cgi which use libxml2 and libxslt.
> In my xsl I use exslt and then before calling xsltApplyStylesheet, I
call
> xmlSubstituteEntitiesDefault(1);
> exsltRegisterAll();
> The exslt function I use is str:encode-uri, because I have some urls
which
> have a parameter which is a url too.
> My cgi does:
>
> xmlSubstituteEntitiesDefault(1);
> exsltRegisterAll();
> xsltParseStylesheetFile
> xsltApplyStylesheet
> xsltSaveResultToString
>
> and then
> printf("Content-Type: text/html; charset=iso-8859-1\n\n");
> printf(bufptr);
>
> If I print to stderr the result of trasformation the content of url is
ok.
> For example:
> <a href="http://server/cgi-
> bin/x?idm=1&ids=13&tmdg=1&uc=http%3A%2F%2Fserver%2Fcgi-
> bin%2Ftest_content">Link</a>
>
> but when the page is displayed in the browser the url is:
>
> <a href="http://server/cgi-
> bin/x?idm=1&ids=13&tmdg=1&uc=http0X1.6ACE80804AA36P-
>
89527.686218-1.997822server0.000000cgi-bin0.000000test_content">Link</a>
>
> As if the print or browser change the content of href. The behaviour
is
> the same for explorer and firefox.
>
> Any hints or idea?
>
> Thanks for the help
>
> --Marco
>
>
>
------------------------------------------------------------------------
-
> Visita http://domini.interfree.it, il sito di Interfree dove trovare
> soluzioni semplici e complete che soddisfano le tue esigenze in
Internet,
> ecco due esempi di offerte:
>
> - Registrazione Dominio: un dominio con 1 MB di spazio disco + 2
caselle
> email a soli 18,59 euro
> - MioDominio: un dominio con 20 MB di spazio disco + 5 caselle email
> a soli 51,13 euro
>
> Vieni a trovarci!
>
> Lo Staff di Interfree
>
------------------------------------------------------------------------
-
>
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml