Bonjour,
J'utilise le processeur XSLT de Microsoft sous delphi avec ce code :
	
	| 12
 3
 4
 5
 6
 7
 8
 9
 10
 
 |                   XMLDoc := CoFreeThreadedDOMDocument40.Create;
                  XSLDoc := CoFreeThreadedDOMDocument40.Create;
                  XMLDoc.loadXml(XMLDocument.XML.Text);
                  XSLDoc.loadXml(XSLDocument.XML.Text);
                  Template := CoXSLTemplate40.Create;
                  Template.stylesheet := XSLDoc;
                  Processor := Template.createProcessor;
                  Processor.input := XMLDoc;
                  Processor.transform;
                  str.Text := Processor.output; | 
 Dans mon fichier XML j'ai bien
	
	<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" encoding="UTF-8"/>
 qui devrait donner une sortie en UTF-8 mais elle est en fait en UTF-16.
En cherchant sur le net j'ai trouvé ça :
	
		
			
			
				MSXML uses the encoding attribute if the output is written to a byte stream,
but not if it is written to a character string or to a DOM: in those cases
the encoding is predefined by the target object. In particular Microsoft
character strings are always UTF-16.
			
		
 
	 
 Soit en français (j'ai laissé la version originale au cas où ma traduction soit erronée) :
	
		
			
			
				MSXML utilise l'attribut encoding si la sortie est écrite dans un flot binaire, mais pas si elle est écrite dans une chaine ou un DOM : dans ces cas l'encodage est prédéfini dans l'objet cible. En particulier les chaînes de caractères Microsoft sont toujours en UTF-16.
			
		
 
	 
 Quelqu'un sait comment je pourrais avoir une sortie correcte en UTF-8 ?
Merci d'avance
						
					
Partager