- Powered by Domino 8.5.2 Domino Accelerator Pack
- Accelerate your web applications
Lotus Triple Search DominoExperts + Blogs + R8 forum -> General Domino Talk

 Formating the HTTP header with correct charset

Tomas NielsenPost date: 2007-01-19 10:06

I'm in the habit of using a lot of OpenAgent functions in my coding. There is a disadvantage to this because when you start doing your own header formatting you are on your own - Domino will not help you here.

The problem I kept running into was that the server had one charset UTF-8 (I prefer this) but the browser was defaulting to ISO-8859-1. So when I was javascript-alerting the Subject of the processed document to the user the message was all distorted with all foreign characters wrong.

When monitoring the HTTP-headers with a reverse proxy program (I use Charles) I finally found the solution. Just add the "charset=UTF-8" parameter to the content-type line. See example below.

That's also a good example of a page that definitely will not get cached.  :-) 

   Print "Content-type:text/html; charset=UTF-8" ' Format a nice header telling the content type.
   Print |Cache-control: max-age=0|
   Print |Cache-control: no-cache, no-store, must-revalidate|
   Print ""
   Print |<html><head>|
   Print |<SCRIPT Language="JavaScript">|
   Print |<!--|
   Print |alert("Change done for: "| + doc.Subject(0) + |;|
   Print |document.location.href = "/";|
   Print |//-->|
   Print |</script>|
   Print |</head></html>|

RSS feed
Subscribe to Forum

Share this page

Top posters
Tomas Nielsen212
Joacim Boive27
Fredrik Stöckel27
Niklas Waller13
Kenneth Haggman11
Bryan Kuhn10
Daniel Lehtihet9
Jonas Israelsson8