Encoding in LC server - the final piece of the puzzle

Ralf Bitter rabit at revigniter.com
Sat Sep 16 05:50:40 EDT 2023


Neville, did you try:

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

before sending the output to the client?


Ralf


On 16.09.2023 03:11, Neville Smythe via use-livecode wrote:
> With the help of forum readers  I have textEncode/Decode working in LC Server so that I can handle file names with ute-8 encoding and talking to mysql in tongues.
> 
> But now I want to produce html documents including Chinese characters encoded with utf-8, using LC Server to output an .lc file to publish on the web. I had naively thought that putting in the “<meta charset=utf-8 >” header at the top would do it, but no, LC Server apparently serves up html with charset=ISO-8859-1 (the native encoding) declared by default, and that overrides the header in the .lc file. The encoding declared was checked using "Rex Swains HTTP Viewer”. I am reasonably confident the actual content of the file is correct utf-8, since the Chinese glyphs are rendered as garbage ISO-Latin characters not as ????
> 
> The next step was adding a line such as
> 
> AddCharset UTF-8 .lc
> 
> to .htaccess. No help. I note that other web pages on the server are created by WordPress, and they have the charset=utf-8 declared.
> 
> I presume I am ignorant of some environment setting which controls what HTTPHeader is declared in the output from LCServer? The obvious choice “the HTTPHeaders” but that is not the answer it seems.
> 
> [I know I can get individual unicode characters to render using html escapes such as &x2304; even when the  page is declared with a non-unicode encoding, but that is not a viable solution here.]
> 
> Neville Smythe



More information about the use-livecode mailing list