473,757 Members | 8,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Euro Dollar Frustration - XSLT, ASP

I'm having problems displaying the ? euro dollar sign in XML produced
from an XSL transform.

SQL Server 2000 is used to produce XML (SELECT .. FOR XML) from a
database table containing data. The euro dollar displays fine in the
database table and in the SQL Server generated XML(snippet below) but
not in the transformed XML. In fact in this post it will probably
appear as a question mark anyway!

<transporttype> Vehicle types include Suzuki Samurai Jeep, closed
air-con cars, Jimny Jeeps with A/C, and Vitara convertible Jeeps with
A/C. Rates from ?70 to ?85 per day. The above rate includes 3rd party
insurance, unlimited kilometres and delivery to
hotels.</transporttype>

Having done the transform in ASP (below) the output XML file has the
'?' instead of the intended '?'. Having fiddled with encoding types
set in ASP code (see below) I coaxed a '¤' out of it!

ASP scripts are used to request the XML from database (stored
procedure) then transform it using XSLT:

Set objConn = CreateObject("A DODB.Connection ")
Set objCMD = CreateObject("A DODB.Command")
set objDOM = CreateObject("M sxml2.FreeThrea dedDOMDocument. 3.0")
set objDOMOutput = CreateObject("M sxml2.FreeThrea dedDOMDocument. 3.0")
set objXSL = CreateObject("M sxml2.FreeThrea dedDOMDocument. 3.0")
objDOM.async = false
objXSL.async = false
.... some setting up db connections and SQL strings for objCMD here
objCMD.Properti es("Output Stream") = objDOM
objCMD.Execute , , 1024
Dim objPI
set objPI = objDom.createPr ocessingInstruc tion("xml", "version='1 .0'
encoding='UTF-8'")
objDom.insertBe fore objPI, objDom.childNod es(0)
objXSL.load(arr StyleSheet(i))
objDOM.transfor mNodeToObject objXSL, objDOMOutput

the transformed xml is then passed to the function:

asCreateFile(lc ase(strFilePath ), lcase(strFileNa me),
asDOM2XML(objDO MOutput))

function asCreateFile(pa th, name, content)
Dim objStream
asCreateFile = false
if asCreatePath(pa th) then
set objStream = Server.CreateOb ject("ADODB.Str eam")
objStream.Type = 2
objStream.Chars et = "iso-8859-1"
objStream.Open
objStream.write text(content)
objStream.SaveT oFile path & name, 2
objStream.Close
Set objStream = nothing
asCreateFile = true
end if
end function

Not entirely sure what asDOM2XML function does but here it is for all
those interested:

function asDOM2XML(objDO M)
'/* used to be: objDOMOutput.fi rstChild.xml &
replace(objDOMO utput.childNode s(1).xml,chr(13 )+chr(10),"<br/>")
if objDOM.childNod es.length > 1 then
asDOM2XML = objDOM.firstChi ld.xml &
replace(objDOM. lastChild.xml,c hr(13)+chr(10), "<br/>")
else
'asDOM2XML = replace(objDOM. firstChild.xml, chr(13)+chr(10) ,"<br/>")
asDOM2XML = objDOM.xml
end if
end function
Jul 20 '05 #1
2 5208
In article <26************ **************@ posting.google. com>,
Iain Toft <i.****@uea.ac. uk> wrote:
I'm having problems displaying the ? euro dollar sign in XML produced
from an XSL transform.
I don't know anything about SQL or ASP, but I notice you have
objStream.Chars et = "iso-8859-1"


The Euro symbol does not exist in iso-8859-1. Try using iso-8859-15
instead.

-- Richard
--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
Jul 20 '05 #2
See http://msdn.microsoft.com/library/en...lencodings.asp

The problem is most likely in the asCreateFile function which is saving the
DOM document to a file via the SaveToFile method on an ADODB.Stream object
specifying the an encoding that cannot handle the Euro character. This is
silly. You can easily save a DOM document to file using the DOM object's
own save method, and it is more likely to encode the document correctly that
way as follows:

objDOMOutput.sa ve(path);

It appears the author of this code was concerned about converting the
newlines in the xml markup to <br/> tags, perhaps in an attempt at having
the XML formatted properly in the browser.

Another way to achieve this is to wrap the XML output in <pre> tags. Or if
you really still need to call asDOM2XML then you could "reload" this string
into the DOM object so you can use the DOM object to save the xml to disk
properly.
"Iain Toft" <i.****@uea.ac. uk> wrote in message
news:26******** *************** ***@posting.goo gle.com...
I'm having problems displaying the ? euro dollar sign in XML produced
from an XSL transform.

SQL Server 2000 is used to produce XML (SELECT .. FOR XML) from a
database table containing data. The euro dollar displays fine in the
database table and in the SQL Server generated XML(snippet below) but
not in the transformed XML. In fact in this post it will probably
appear as a question mark anyway!

<transporttype> Vehicle types include Suzuki Samurai Jeep, closed
air-con cars, Jimny Jeeps with A/C, and Vitara convertible Jeeps with
A/C. Rates from ?70 to ?85 per day. The above rate includes 3rd party
insurance, unlimited kilometres and delivery to
hotels.</transporttype>

Having done the transform in ASP (below) the output XML file has the
'?' instead of the intended '?'. Having fiddled with encoding types
set in ASP code (see below) I coaxed a '¤' out of it!

ASP scripts are used to request the XML from database (stored
procedure) then transform it using XSLT:

Set objConn = CreateObject("A DODB.Connection ")
Set objCMD = CreateObject("A DODB.Command")
set objDOM = CreateObject("M sxml2.FreeThrea dedDOMDocument. 3.0")
set objDOMOutput = CreateObject("M sxml2.FreeThrea dedDOMDocument. 3.0")
set objXSL = CreateObject("M sxml2.FreeThrea dedDOMDocument. 3.0")
objDOM.async = false
objXSL.async = false
... some setting up db connections and SQL strings for objCMD here
objCMD.Properti es("Output Stream") = objDOM
objCMD.Execute , , 1024
Dim objPI
set objPI = objDom.createPr ocessingInstruc tion("xml", "version='1 .0'
encoding='UTF-8'")
objDom.insertBe fore objPI, objDom.childNod es(0)
objXSL.load(arr StyleSheet(i))
objDOM.transfor mNodeToObject objXSL, objDOMOutput

the transformed xml is then passed to the function:

asCreateFile(lc ase(strFilePath ), lcase(strFileNa me),
asDOM2XML(objDO MOutput))

function asCreateFile(pa th, name, content)
Dim objStream
asCreateFile = false
if asCreatePath(pa th) then
set objStream = Server.CreateOb ject("ADODB.Str eam")
objStream.Type = 2
objStream.Chars et = "iso-8859-1"
objStream.Open
objStream.write text(content)
objStream.SaveT oFile path & name, 2
objStream.Close
Set objStream = nothing
asCreateFile = true
end if
end function

Not entirely sure what asDOM2XML function does but here it is for all
those interested:

function asDOM2XML(objDO M)
'/* used to be: objDOMOutput.fi rstChild.xml &
replace(objDOMO utput.childNode s(1).xml,chr(13 )+chr(10),"<br/>")
if objDOM.childNod es.length > 1 then
asDOM2XML = objDOM.firstChi ld.xml &
replace(objDOM. lastChild.xml,c hr(13)+chr(10), "<br/>")
else
'asDOM2XML = replace(objDOM. firstChild.xml, chr(13)+chr(10) ,"<br/>")
asDOM2XML = objDOM.xml
end if
end function

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
25939
by: Robert Zierhofer | last post by:
hi there, it seems as if i can´t convert the euro and pound sign to their html equivalents. i tried eregi_replace("€", "&euro;", $haystack); eregi_replace("£", "&pound;", $haystack); as well as
11
12810
by: MH | last post by:
Thai may have been asked before but I'm new here.... How can I put the Euro symbol, ? using alt0128 in my page and get it validated as HTML 4.01 ? -------------- MH
18
6519
by: gabriel | last post by:
greetings, I am currently working on a website where I need to print the Euro symbol and some "oe" like in "oeuvre". If I choose this : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > <html
5
7067
by: SalamElias | last post by:
I followed instructions in MSDN help articles and wrotethe folowing code in order to display numeric numbers with Euro symbol as follows : ---------------------------- Dim OutString As = "" Dim frCulture As New CultureInfo("fr-FR", False) Thread.CurrentThread.CurrentCulture = frCulture Dim myCurrency As New (123456) myCurrency.ToString("C", LocalFormat) OutString = "Euro : " + myCurrency.ToString("C", NumberFormatInfo.CurrentInfo)
8
3674
by: Max | last post by:
My client has decided to use the Euro for the entire web site. Is there an easy way to get my ASP.NET app to format currency to Euro instead of US-dollar? Right now it's just reading the server settings, but I'd rather set this say at start up in the global.asax since other web sites running on the server may not share this setting. -Max
1
7000
by: news.wanadoo.nl | last post by:
Hi, Is there a sollution for a DataFormatString as currency that shows always the euro sign: ? <asp:BoundColumn DataField="UnitCost" HeaderText="Prijs" DataFormatString="{0:c}"></asp:BoundColumn> <%# DataBinder.Eval(Container.DataItem, "UnitCost", "? {0}") %>
7
3323
by: kingski | last post by:
Any idea about this ? http://www.developerfusion.co.uk/forums/thread/114379/#114379 "Can any one help me as i am building a shopping cart and it supports multiple currencies but while sending confirmation mail o customer it does not show euro sign before amount he paid but it is showing a queston mark over there. It is working fine with Dollar sign and Pound Sign but this Euro is creating problem. " thanks.
0
1116
by: kingski | last post by:
Any idea about this? http://www.developerfusion.co.uk/forums/thread/114379/#114379 "Can any one help me as i am building a shopping cart and it supports multiple currencies but while sending confirmation mail o customer it does not show euro sign before amount he paid but it is showing a queston mark over there. It is working fine with Dollar sign and Pound Sign but this Euro is creating problem. " thanks.
7
10628
by: Robertu | last post by:
Hi at all I'ld want inserrt into my emails body the ? euro symbol therefore I wrote the header of my emails like : $headers="From: $mail_from\n\r"; $headers.='X-Mailer: PHP/' . phpversion()."\r\n"; $headers.="MIME-Version: 1.0\r\n"; $headers.= "Content-Type: text/html; charset=utf-8\r\n"; $headers.="Content-Transfer-Encoding: 8bit\r\n\r\n";
0
9298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10072
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9906
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9737
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.