encoding woes!?

Klaus major-k klaus at major-k.de
Tue Oct 29 15:38:11 EDT 2019


Hallo Hermann,

> Am 29.10.2019 um 20:02 schrieb hh via use-livecode <use-livecode at lists.runrev.com>:
> 
> Just saw it now, overlooked that first:
> 
> You script
> put textencode(tTExt,"UTF8") into url ("file": ...)
> 
> This should read
> put textDecode(tTExt,"UTF8") into url ("file": ...)

mhhh, when I have this in fld 1:
########################################
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>-</title>
</head>
<body>
<p>äÄüÜöÖßßß</p>
</body></html>
###########################################

And do
...
put textDecode(tTExt,"UTF8") into url ("file": ...)
...

The resulting file looks like:
########################################
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>-</title>
</head>
<body>
<p></p>
</body></html>
###########################################
All umlauts are gone!?

With:
...
put textencode(tText,"UTF8") into url ("file": ...)
...
It looks fine in Safari and a browser widget!?

> But why using files?

Das geht Dich gar nichts an! :-D

Joke aside, the file gets saved in my Dropbox and I share it
with another user of LC!

> If you don't want to type directly in the browser widget
> you can make it "mirroring" a text field.
> 
> Example for a primitve HTML editor:
> 
> 1. Write into fld "HTML"
> <html><head><meta charset="utf-8"></head>
> <body>[[ht]]</body></html>
> (You can now hide fld "HTML").
> 
> 2. Then make a field "Tippse" and script it:
> 
> on textchanged
>  put the htmltext of me into ht
>  replace "</p>" with "<br>" in ht
>  replace "<p>" with empty in ht
>  set htmltext of widget "browser" to merge(fld "HTML")
> end textchanged
> 
> on enterInField
>  textchanged
> end enterInField
> 
> Then you can do what your textfield allows
> set textfont (bears some problems), textsize, styles etc.
> and the widget will display it (well, approximately...)
> 
> [Another variant is to write directly into the DOM structure
> of the current HTMLtext.]

Thanks, stored for possible future use. :-)


Best

Klaus
--
Klaus Major
https://www.major-k.de
klaus at major-k.de





More information about the use-livecode mailing list