Syntax
| SendAnsi sText$ [, bIncludeEOL]
| ||||||
|---|---|---|---|---|---|---|---|
Description
| Writes a legacy Windows-1252 encoded string directly to the HTTP response body, without any character set conversion. This statement is intended for CCL scripts that deliberately produce single-byte Windows-1252 output, typically for backwards compatibility with older clients or legacy systems that do not accept UTF-8.
Each CCL character code point in sText$ is written as exactly one output byte. Where the standard Send statement automatically converts its payload to UTF-8 and manages the Content-Type header with charset=utf-8, SendAnsi performs no conversion at all, and will only set a default Content-Type header of "text/html; charset=windows-1252" when the calling script has not already assigned a Content-Type itself.
If a Content-Type header was already set by the script, SendAnsi leaves it completely untouched, giving the caller full control over the declared encoding and media type. SendAnsi is not the recommended statement for new development; use Send for all modern CCL output, which produces correct UTF-8 bytes on the wire with automatic charset handling.
SendAnsi exists specifically to support legacy scripts and integrations that require the original pre-UTF-8 behaviour of the CCL web server.
| ||||||
See Also
| |||||||
Example
| Sub Main
Dim sPage As String
sPage = "<html><head>" & _
"<meta charset=""windows-1252"">" & _
"<title>Legacy output</title>" & _
"</head><body>"
sPage = sPage & "<h1>Fuer den Archivierungsprozess</h1>"
sPage = sPage & "<p>Umlaute: " & Chr$(252) & Chr$(228) & Chr$(246) & Chr$(223) & "</p>"
sPage = sPage & "</body></html>"
ParentResponse.Header.Add httpContentType, "text/html; charset=windows-1252", True
SendAnsi sPage
ParentResponse.Status = httpOK
ParentResponse.Send
End Sub
|