• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

XML Transformation Encoding

New Here ,
Jun 01, 2006 Jun 01, 2006

Copy link to clipboard

Copied

Hello, when i do transformation of xml to html and if i have french characters i receive in the html garbage characters instead i tried all encoding starting with utf-8 .... but the problem persist.

this is my xml
<MyDoc>
<TagTR index="PK">
<TagTD libelle="Emballage">Emballage Intermédiaire</TagTD>
</TagTR>
</MyDoc>

this is part of my my xsl
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="2.0"
xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"
xmlns=" http://www.w3.org/TR/REC-html40"
xml:lang="fr">
<xsl utput method="html" version="1.0" encoding="utf-8"/>
<xsl:template match="MyDoc">
<xsl:for-each select="TagTR">
<tr>
<td><xsl:value-of select="TagTD[@libelle='Emballage']" /></td>
</tr>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

this is the output iam receiving

Emballage Intermédiaire




any help please
TOPICS
Advanced techniques

Views

397

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 02, 2006 Jun 02, 2006
credev wrote:
> well infact thats my xsl

not to nit pick but that's not the same code & you did say it was "part". in any
case that xsl works. i output unicode hindi, arabic, thai, japanese, etc. ok. so
it's not cf, your xml or xsl. see: http://www.sustainablegis.com/unicode/xml/
using this code:

=====================
<cfprocessingdirective pageencoding="utf-8">
<cfquery name="getU" datasource="#dsn#">
SELECT uniText
FROM unicodeTest
ORDER BY uniLanguage
</cfquery>

<cfset xslFile=getDi...

Votes

Translate

Translate
LEGEND ,
Jun 02, 2006 Jun 02, 2006

Copy link to clipboard

Copied

credev wrote:
> Hello, when i do transformation of xml to html and if i have french characters
> i receive in the html garbage characters instead i tried all encoding starting
> with utf-8 .... but the problem persist.
>
> this is my xml
> <MyDoc>
> <TagTR index="PK">
> <TagTD libelle="Emballage">Emballage Interm?diaire</TagTD>
> </TagTR>
> </MyDoc>

and what's the xml doc's original encoding? what ver of cf? are you "touching"
the xml doc using cffile, etc.?


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 02, 2006 Jun 02, 2006

Copy link to clipboard

Copied

my xml is <?xml version="1.0" encoding="utf-8"?><MyDoc/> created with cfxml

the thing is that iam creating an xmlDoc loaded in memory ( by retreviving data from DB) then aim transforming this xmlDoc to html usingthe above xsl.

iam not beeing able to figure out whats going wrong.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 02, 2006 Jun 02, 2006

Copy link to clipboard

Copied

now that i see this stuff in the forums, it really looks like a simple encoding issue. but your xsl isn't complete enough for me to test to see where the issue actually lies.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 02, 2006 Jun 02, 2006

Copy link to clipboard

Copied

well infact thats my xsl

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="2.0"
xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"
xmlns=" http://www.w3.org/TR/REC-html40"
xml:lang="fr">

<xsl utput method="html" version="1.0" encoding="utf-8"/>
<xsl:template match="MyDoc">
<xsl:for-each select="TagTR">
<tr class="Arial_2_noir" height="10" align="left" valign="top" bgcolor="#CCCCCC">
<td><xsl:value-of select="TagTD[@libelle='Emballage']" /></td>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

and the xml doc is
<?xml version="1.0"?>
<MyDoc>
<TagTR>
<TagTD libelle="Emballage">Emballage Intermédiaire</TagTD>
</TagTR>
</MyDoc>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 02, 2006 Jun 02, 2006

Copy link to clipboard

Copied

credev wrote:
> well infact thats my xsl

not to nit pick but that's not the same code & you did say it was "part". in any
case that xsl works. i output unicode hindi, arabic, thai, japanese, etc. ok. so
it's not cf, your xml or xsl. see: http://www.sustainablegis.com/unicode/xml/
using this code:

=====================
<cfprocessingdirective pageencoding="utf-8">
<cfquery name="getU" datasource="#dsn#">
SELECT uniText
FROM unicodeTest
ORDER BY uniLanguage
</cfquery>

<cfset xslFile=getDirectoryFromPath(GetCurrentTemplatePath())&"test.xsl">
<cffile action="read" file="#xslFile#" variable="xslDoc" charset="utf-8">

<cfxml variable="MyDoc">
<?xml version="1.0" encoding="utf-8"?>
<MyDoc>
<cfoutput query="getU">
<TagTR index="PK">
<TagTD libelle="Emballage">#uniText#</TagTD>
</TagTR>
</cfoutput>
</MyDoc>
</cfxml>

<cfset transformedXML = XmlTransform(mydoc, xslDoc)>

<table><cfoutput>#transformedXML#</cfoutput></table>
=====================

btw i don't like what the transform did to the vietnamese (last row in the table).

what ver of cf? if you dump the data out of the database via cf using utf-8
encoding, does it work? what encoding turns up in your browser when you run your
cf page?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 02, 2006 Jun 02, 2006

Copy link to clipboard

Copied

LATEST
Well i should say thank you alot... you just fixed my problem

i added <cfprocessingdirective pageencoding="utf-8"> to the top page where iam loading my xml and it worked!

thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation