Hi Victor, Hi Geert,

 

Before sending it off to Lew I was hoping to check how the change would
affect XML documents, especially those with embedded scripting. I am not
sure if the ' might cause some problems, so I think it best to test it.
I have found some interesting things though. 

 

I have been wondering why I have not been having so many problems, and why
the problem has not been biting me so much. One of the reasons is that I
tend not to supply HTML out from DP, but instead I am more inclined to use
XML, and if I am displaying a webpage I generally use XSLT to transform the
XML, either on the server or sometimes at the client side, and I am in
control of the entities.

 

For static XHTML documents I have been trying to figure if you could add the
Entity declaration to the the XHTML doctype Declaration, by adding an
<!ENTITY apos "&#39">. However this caused the browser to mangle the
declaration and output an extra ]> into the beginning of the body of the
document. It seemed that the only real way to fix that was to replace the
W3C DTD with your own DTD which is quite a bit of work, and about 40k would
be needed to add to each page, not such a great idea.

 

But then I did some work with this: 

 

Try this with Firefox, (Safari, Opera etc) and you will see what I mean.

1. Copy this code to a file and save it as test.html

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"; 

[

<!ENTITY bad "This is bad bad thing">

<!ENTITY apos "#39">

]

> 

<html xmlns="http://www.w3.org/1999/xhtml";>

<head>

<title>Brian&apos;s custom entities</title>

</head>

 

<body>

&bad;

</body>

</html>

And then open it in Firefox. The browser will display:  

]> &bad; 

Ie the problem that I described before.

The doctype gets managed because it really does not recognise this as an XML
document. Even putting an XML prolog 

<?xml version="1.0" encoding="iso-8859-1"?> 

does not help.

 

However rename the file to test.xhtml and it all works fine. That is because
Firefox and most browsers (except IE) know that a file with the extension
.xhtml is not HTML. If you try it in IE instead of it being display you will
be prompted to Open the file (but it will probably open it in Firefox, or
ask you to Save the file. This is because IE does not understand the
reqquire MIME type for this file extension.

 

There are two ways you can change thing for IE. One is via the computers
registry :

[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/xhtml+xml]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
"Extension"=".xhtml"

Which adds a new handler for .xhtml documents. But not at all practical
since you cannot access the registry of Joe public’s computer. 

 

Alternatively, you can change the Content Type header  at the web server
side to deliver the content of .xhtml files as 

Content-type: application/xhtml+xml  

 

When I am working with dynamic DP data with PERL script, I have to
explicitly use a Content-Type header anyway, so instead of the more usual
text/html changing it to the correct content type fixes things. I think it
is also possible to configure the web server to output this Content-Type
header when directly working with .xhtml files, or if you only work  with
valid XHTML files but not with that extension change that the content header
for all htm. .html or .xhtml files, but I have not tested that, yet. But if
you try to use an non XHTML document with a .htm or .html name then you will
get into trouble with this.  The reason this does not affect with me with
dynamic DP web application is that the request to the server is via CGI and
my script eg myscript.pl is responsible for setting the content header and
it will not work if I don’t.

 

If the hex editing hack works though it might be a good thing to do and to
get Lew to fix it.

 

I might post this back up to the mailing list, rather than just you. As it
might get some more comments.

 

Regards

Brian

 

 

 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of [email protected]
Sent: Monday, 23 August 2010 1:52 AM
To: [email protected]
Subject: Re: [Dataperf] ' character and &apos;

 

Hi Victor,

 

We've been discussing this problem on the mailing list last week with  

Brian Hancock.

 

For the time being, the only solution seems to be to open the DP26YI.EXE  

(or DP26YU.EXE, according to the version you want to use) with a  

HEX-editor, to replace the string "&apos;" in line 251d0 by "&#039;" and  

to save the modified file under a new name...

 

However, we hope Lew can release this mod as an *official* change, so that  

no hacked versions op DP need to exist !

 

Kind regards,

Geert De Baets

mailto:[email protected]

 

 

 

On Sun, 22 Aug 2010 15:21:59 +0200, Victor Warner <[email protected]> wrote:

> I am having a problem sending a report to a text file for use as html.

> I start DP (using Windows 7 Professional and Tame 6 rc 15) with the

> following command line:

> G:\dp\dp.exe e:\dbs\french\grammer\grammer /P=1 /W

> For fields in the report I use the ;;W suffix.

> When I enter the ' character, the result is a &apos; such as "a

> l'extèrieur". Therefore it cannot be avoided (ie if it was a quote mark,

> by the use of ").

> However, it does not get recognised in browsers. Doing a google search

> seems to confirm this is a problem (http://en.wikipedia.org/wiki/Apos;

>
http://stackoverflow.com/questions/2083754/why-shouldnt-apos-be-used-to-esca
pe-single-quotes,

> etc)

> It is easy enough to do a search and replace for this, but is it

> possible to avoid the problem altogether in DataPerfect?

> Help with this would be greatly appreciated.

> Victor Warner.

_______________________________________________

Dataperf mailing list

[email protected]

http://lists.dataperfect.nl/mailman/listinfo/dataperf

_______________________________________________
Dataperf mailing list
[email protected]
http://lists.dataperfect.nl/mailman/listinfo/dataperf

Reply via email to