More questions regarding Server oddities

Lyn Teyla lyn.teyla at gmail.com
Fri Dec 25 17:36:02 EST 2015


Peter W A Wood wrote:

> I don’t think the problem is related to the HTTP Header. It is the same for both Tim’s rev page and his lc page:
> 
> 	<meta http-equiv="Content-type" content="text/html; charset=utf-8">

Having a "Content-Type" meta tag is not the same as implementing a "Content-Type" HTTP header via the "put header" command.

The former is generally used by a web browser when a HTTP header containing the desired charset is not present, typically when displaying local (offline) HTML pages, so it knows what to use.

When it comes to determining the charset of a page that’s served online, however, a web browser’s first port of call is the "Content-Type" HTTP header, which as mentioned in one of my earlier replies, can be specified using:

   put header "Content-Type: text/html; charset=" & quote & "utf-8" & quote

For more information about HTTP headers, visit:

   https://en.wikipedia.org/wiki/List_of_HTTP_header_fields

If you’re curious as to why the meta tag happens to work with revServer 3.5 but not later versions of LiveCode Server such as 6.6.2:

The technical reason is that older versions such as revServer, by default, output the following HTTP header if the above "put header" statement isn’t specified:

   Content-Type: text/html

Since no charset is specified by default, some web browsers then take the meta tag into account.

Later versions of LiveCode Server (including the current versions), by default, output the following HTTP header if the above "put header" statement isn’t specified:

   Content-Type: text/html; charset=iso-8859-1

While this change in the default behavior of LiveCode Server is a somewhat unorthodox (I personally don’t agree with the concept of forcing a particular charset by default), it might be a stretch to call it a bug, since there’s a perfectly valid way of specifying the charset using the "put header" method.


> Tim doesn’t really have a choice over which version of the server to use with the On-Rev service. The version is chosen by LiveCode.

It’s certainly true that Tim doesn’t have control over the built-in version of LiveCode Server with the On-Rev service. Nevertheless, he doesn’t have to be stuck with that at all, as he could install the desired version per the usual .htaccess method:

http://lessons.livecode.com/spaces/lessons/buckets/809/lessons/36655

Tim did mention that he had tried his scripts from a non On-Rev server, so I’m assuming he already knows how to install the desired version.


Feel free to let me know if anything requires further clarification.

Lyn






More information about the use-livecode mailing list