I have come up with a small way to read and correctly display form data with non-ascii characters in OpenMCL, which does not support Unicode. Or at least, I think I have. There may be good reason not to do things this way - someone let me know if that is the case.
First, I redefined escape-for-html so that it would return NIL if its parameter was NIL instead of generating an error. Then I just used escape-for-html instead of escape-string-all when displaying the parameter (I was just playing around with the tests that came with TBNL here).
My question is this: are there problems that can arise with the use of escape-for-html that escape-string-all avoids? If not, then I'll just be using this.
Tim Bennett
Hi!
On Sat, 8 Oct 2005 00:46:30 -0700, Timothy Bennett timothy.s.bennett@gmail.com wrote:
I have come up with a small way to read and correctly display form data with non-ascii characters in OpenMCL, which does not support Unicode.
It doesn't? Oh, I didn't know that.
Or at least, I think I have. There may be good reason not to do things this way - someone let me know if that is the case.
First, I redefined escape-for-html so that it would return NIL if its parameter was NIL instead of generating an error. Then I just used escape-for-html instead of escape-string-all when displaying the parameter (I was just playing around with the tests that came with TBNL here).
My question is this: are there problems that can arise with the use of escape-for-html that escape-string-all avoids? If not, then I'll just be using this.
This is assuming that OpenMCL uses 8-bit characters similar to CMUCL:
ESCAPE-STRING-ALL will escape /all/ characters that aren't part of the 7-bit ASCII repertoire while ESCAPE-FOR-HTML will only escape a couple of "critical" characters like < and &. This is relevant if your HTML page contains non-ASCII characters (like, say, umlauts). If you don't escape them you better send corresponding information to the browser (which is a good idea anyway) - either a header like
Content-Type: text/html; charset=iso-8859-1
(which is the default header used by TBNL) or a meta tag like
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">.
Cheers, Edi.