"dà © jà vu" ----> "déjà-vu" (='.'=)

Are you using LiveCode to create server scripts or CGIs?

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Mariasole
Posts: 214
Joined: Tue May 07, 2013 9:38 pm

déjà vu (='.'=) [LiveCodeServer]

Post by Mariasole » Tue May 24, 2016 1:19 pm

I'm doing one of my experiments! :D
LC Server unfortunately adopts as the default charset output the "iso-8859-1".
So if I put on server a simple html page* that says "deja-vu", the LC server will restore me as "dà © jà vu".
Now, it is easy to "correct", I need to put this script in every page:

Code: Select all

put header "Content-Type: text/html; charset=utf-8" 
But if I have a thousand pages, I can tell the LC server maybe via .htaccess to output in UTF8 and not in "iso-8859-1"? :roll:
Many thanks for your help!


Mà rìà sòlè :wink:
(='.'=)


* LiveCodeServer works in my .htaccess with ext: .htm/.html/.lc/ .rev
Last edited by Mariasole on Tue May 24, 2016 1:34 pm, edited 1 time in total.
No input, no output. Man - Joe Strummer
Garbage in, garbage out (GIGO) - anonymous

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 311
Joined: Mon Jun 10, 2013 1:32 pm

Re: déjà vu (='.'=)

Post by Lagi Pittas » Tue May 24, 2016 1:33 pm

Hi Mariasole

short answer:

Code: Select all

AddCharset UTF-8 .html
Long answer ...
A particularly erudite exposition from w3

https://www.w3.org/International/questi ... charset.en

Lagi

Mariasole
Posts: 214
Joined: Tue May 07, 2013 9:38 pm

Re: déjà vu (='.'=) [LiveCodeServer]

Post by Mariasole » Tue May 24, 2016 1:56 pm

Thanks Lagi for your support!
Unfortunately it does not work ... :cry:
I've also tried to put that kind of string. That's why I asked the question. :oops:
Here is my configuration of .htaccess:

Code: Select all

AddCharset UTF-8 .htm ---> don't work
#AddCharset utf-8 .lc .irev .html .htm ---> don't work
#AddDefaultCharset utf-8 ---> don't work

AddHandler livecode-script .lc .irev .html .htm
Action livecode-script /cgi-bin/livecode-community-server

Here is my html file:

Code: Select all


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Déjà vu</title>
</head>

<body>
Déjà vu
</body>
</html>



And here's the result!

Déjà vu


How can it be done? :?



again...

Mà rìà sòlè :wink:
(='.'=)
No input, no output. Man - Joe Strummer
Garbage in, garbage out (GIGO) - anonymous

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 311
Joined: Mon Jun 10, 2013 1:32 pm

Re: déjà vu (='.'=) [LiveCodeServer]

Post by Lagi Pittas » Tue May 24, 2016 4:03 pm

Hi

How about trying

Code: Select all

<FilesMatch "\.(htm|html|css|js|rev|livecode|lc|irev)$">
ForceType 'text/html; charset=UTF-8'
</FilesMatch>
in the .htaccess

If it doesn't work. We'll try a different tack. I am upto my ears on a project at the moment so can't spend time to test it.



Lagi

Mariasole
Posts: 214
Joined: Tue May 07, 2013 9:38 pm

Re: déjà vu (='.'=) [LiveCodeServer]

Post by Mariasole » Tue May 24, 2016 4:09 pm

Thank you Lagi!
Grazie mille per il tuo prezioso tempo!

AddCharset UTF-8 .htm ---> don't work
AddCharset utf-8 .lc .irev .html .htm ---> don't work
AddDefaultCharset utf-8 ---> don't work

:cry:

Mà rìà sòlè :wink:
(='.'=)
No input, no output. Man - Joe Strummer
Garbage in, garbage out (GIGO) - anonymous

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 311
Joined: Mon Jun 10, 2013 1:32 pm

Re: déjà vu (='.'=) [LiveCodeServer]

Post by Lagi Pittas » Tue May 24, 2016 4:27 pm

Did you try?

Code: Select all

<FilesMatch "\.(htm|html|css|js|rev|livecode|lc|irev)$">
ForceType 'text/html; charset=UTF-8'
</FilesMatch>
Otherwise maybe your htaccess is not being recognised for some reason.
It Happens

lagi

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 278
Joined: Tue Apr 10, 2012 9:18 am

Re: déjà vu (='.'=) [LiveCodeServer]

Post by ghettocottage » Tue May 24, 2016 6:58 pm

Tested on my server and have the same results: .htaccess does not seem to affect the charset of livecode, but using

Code: Select all

    put header "Content-Type: text/html; charset=utf-8" 
works.

However, my PHP files obey the charset of .htaccess, so it is working, just not with Livecode>
But if I have a thousand pages, I can tell the LC server maybe via .htaccess to output in UTF8 and not in "iso-8859-1"? :roll:
Many thanks for your help!
Maybe a different approach would be to just have one header file that you include in all of your other files?

Code: Select all

<?lc include "parts/header.lc" ?>

Mariasole
Posts: 214
Joined: Tue May 07, 2013 9:38 pm

Re: déjà vu (='.'=) [LiveCodeServer]

Post by Mariasole » Tue May 24, 2016 7:01 pm

Hi Lagi,
Thank you so much for your interest.
I'm very grateful.
Unfortunately, the "forcing" does not work! :cry:
I think it does not depend on my Apache, I did try the strings from a friend and he too has the same result! :cry: :cry: :cry:
The fact that the page is "taking charge" and then "released" from LC Server at each call, probably deprives Apache.
Will there be a solution?


Mà rìà sòlè :shock:
(='.'=)
No input, no output. Man - Joe Strummer
Garbage in, garbage out (GIGO) - anonymous

Mariasole
Posts: 214
Joined: Tue May 07, 2013 9:38 pm

Re: déjà vu (='.'=) [LiveCodeServer]

Post by Mariasole » Tue May 24, 2016 7:13 pm

Thanks ghettocottage!
Thanks for trying.
Put the small script clearly works, but I was looking for a "hybrid" solution.
Imagine this situation. 8)
An old site, but beautiful, made with painstaking care page by page that now has decided to have some html "powered by LiveCodeServer". On the server, mandatory extension ".html", have to live the old html with the html "LC powered."
The solutions are three:

a) can not coexist

b) to parse all "old" pages with

Code: Select all

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

Code: Select all

<?lc include "parts/header.lc" ?>
c) put on htaccess a code to see all pages in utf8 (the "powered" pages and the "old" pages).[/b] :wink:

I do not know if I could explain! :P

Thanks!!!!!!!!!!!!
Mà rìà sòlè :shock:
(='.'=)
No input, no output. Man - Joe Strummer
Garbage in, garbage out (GIGO) - anonymous

Mariasole
Posts: 214
Joined: Tue May 07, 2013 9:38 pm

Re: déjà vu (='.'=) [LiveCodeServer]

Post by Mariasole » Wed May 25, 2016 10:55 am

There is a guru of LiveCode Server that could help me?
I understand it's not as exciting as a widget, but this problem could be interesting ... :oops:

Grazie a tutti!

Mà rìà sòlè :shock:
(='.'=)
No input, no output. Man - Joe Strummer
Garbage in, garbage out (GIGO) - anonymous

Mariasole
Posts: 214
Joined: Tue May 07, 2013 9:38 pm

Re: déjà vu (='.'=) [LiveCodeServer]

Post by Mariasole » Wed May 25, 2016 4:35 pm

I had an idea. :idea:
It is possible to pass a "preference" to LiveCodeServer to tell it to output "UTF8" instead of "iso-8859-1" via .htaccess? :D
Thanks for the many who are interested in my problem! And for the general enthusiasm for LC Server!


Mà rìà sòlè
(='.'=)
No input, no output. Man - Joe Strummer
Garbage in, garbage out (GIGO) - anonymous

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 278
Joined: Tue Apr 10, 2012 9:18 am

Re: déjà vu (='.'=) [LiveCodeServer]

Post by ghettocottage » Wed May 25, 2016 4:55 pm

Mariasole wrote:I had an idea. :idea:
It is possible to pass a "preference" to LiveCodeServer to tell it to output "UTF8" instead of "iso-8859-1" via .htaccess? :D
Thanks for the many who are interested in my problem! And for the general enthusiasm for LC Server!


Mà rìà sòlè
(='.'=)
I was wondering the same thing, but not necessarily using the .htaccess. I wonder if there is a way to have a config file for LivecodeServer to set/change some defaults.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6174
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: déjà vu (='.'=) [LiveCodeServer]

Post by FourthWorld » Wed May 25, 2016 5:15 pm

1. Which version of LiveCode are you using?
2. Do you really want HTML pages to be processed with LiveCode in addition to .lc files?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Mariasole
Posts: 214
Joined: Tue May 07, 2013 9:38 pm

Re: déjà vu (='.'=) [LiveCodeServer]

Post by Mariasole » Wed May 25, 2016 6:20 pm

Hi Richard!
1. LCS 8.0.1 :!:
2. Yes, I am very sure, for the reasons I write before ... :)

Thanks! :D

Mà rìà sòlè
(='.'=)
No input, no output. Man - Joe Strummer
Garbage in, garbage out (GIGO) - anonymous

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6174
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: déjà vu (='.'=) [LiveCodeServer]

Post by FourthWorld » Wed May 25, 2016 6:23 pm

Re. #2: I asked because you mentioned that many (most?) of those HTML pages are static, exiting in complete form prior to using LC Server. What is it you want LC Server to do with those?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply

Return to “CGIs and the Server”