Re: [xml] Encoding



printf("Content-Type: text/html; charset=iso-8859-1\n\n");
printf(bufptr);

In fact, if bufptr is a string :
*printf("Content-Type: text/html; charset=iso-8859-1\n\n%s", bufptr);*

bufptr will be written where %s is ( _%s will be replaced by bufptr_ ). Just a C problem, not a xml one.

_____________________________________________
Remy HAREL          -        Teamlog        |
____________________________________________|
Linux registered user #224740               |
France Telecom Recherche & Developpement    |
____________________________________________| __________________@ http://www.chezrem.org @|




ABeylin axsone com wrote:

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: spinmar interfree it [mailto:spinmar interfree it]
Sent: Tuesday, July 26, 2005 5:36 AM
To: xml gnome org
Cc: xslt gnome org
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&amp;ids=13&amp;tmdg=1&amp;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&amp;ids=13&amp;tmdg=1&amp;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/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]