Writing a UTF8 text file to server.

Tim Selander selander at tkf.att.ne.jp
Thu Oct 4 02:48:23 EDT 2018


Hi Scott,

Added info; I have <?lc put header "Content-Type: text/html; 
charset=UTF-8" ?> at the top of the web page source.

Then, I only found outputTextEncoding in the dictionary. It said it only 
works with CGI (server), put when I put:
set the outputTextEncoding to "utf-8"

into the script before dealing with the $_POST array, it broke the Kanji 
on the web page itself.

Googling turned up info on the textEncode function, but this script 
still results with a saved file of gibberish and not Kanji.

Changed the script to this:
put $_POST[firstname]      --(Results in Kanji name to web page)
put "data.txt" into vfile
open file vfile for utf8 text update
put textEncode($_POST[firstname], "UTF-8") into vdata
write vdata to file vfile at end
close file vfile

but still get a file with broken kanji.

Any hints?

Tim




On 2018/10/04 15:08, scott--- via use-livecode wrote:
> Hello Tim,
>
> Did you look at the textEncode function?
>
>> Scott Morrow
>
>> On Oct 3, 2018, at 10:22 PM, Tim Selander via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> I am using Livecode Server on Livecode's hosting plan.
>>
>> Taking my first stab at a web response form. I am getting the data from $_POST fine, and when I simply do something like:
>> put $_POST[firstname]
>>
>> the UTF8/Kanji word shows up fine in the webpage. But I am unable to save the data to a file on the server encoded in UTF8 (simply trying to collect the submitted data).
>>
>> put "data.txt" into vfile
>> open file vfile for utf8 text update
>> put $_POST[firstname] & comma & $_POST[lastname] & comma & $_POST[country] &  the time & return into vdata
>> write vdata to file vfile at end
>> close file vfile
>>
>> Data is getting saved, but in gibberish, not in kanji/utf8.
>>
>> Anyone see what I'm doing wrong?
>>
>> TIA
>>
>> Tim Selander
>> Tokyo, Japan
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list