revBrowser's htmltext property for Unicode text

Slava Paperno slava at lexiconbridge.com
Fri Jun 3 10:19:37 CDT 2011


Thanks for playing with this, Mike.

revBrowserCallScript(browserID, JSFunctionName()) also brings question marks
for the double-byte characters that are returned by JSFunctionName().

I don't understand what you mean by the Web site using "(binary) unicode
text instead of  html encoded text." I thought the browser always receives
text, not binary data, for the HTML source of the Web page to be rendered.
This is certainly the case when the charset in the meta tag is defined as
UTF-8.

In my case this is not relevant because no Web server is involved: I assign
UTF-8 encoded text to the htmltext property of revBrowser, and revBrowser
renders it beautifully, including CSS styles and JS functionality. So it can
receive UTF-8 data, but it seems that we have not found a way for revBrowser
to send double-byte text back to the stack.

I'll wait another day and if nothing new transpires, I'll write to Kevin.
There was an inconclusive discussion of Unicode and revBrowser on the
Externals forum last November, started by Bangkok, where two opposing
opinions were expressed about Unicode and revBrowser. It would be useful to
have a definitive answer about sending UTF-8 from the browser to the stack.

When the data comes from a Web server, I suppose the issue may be less
critical because, as you said, the PUT command can be used to retrieve the
HTML source. If a server-side CGI is involved in creating the page (e.g.,
when some data is retrieved from a database), the PUT command should get the
same data as the revBrowser instance, right? If the answer were No, this
would be a serious security issue: a visitor to the site is not supposed to
be able to retrieve the source of a CGI script from a Web server.

The data may also be changed by the user in the browser, through some user
actions, like filling out a form.

Cheers,

Slava   

> -----Original Message-----
> From: use-livecode-bounces at lists.runrev.com [mailto:use-livecode-
> bounces at lists.runrev.com] On Behalf Of Mike Bonner
> Sent: Friday, June 03, 2011 8:48 AM
> To: How to use LiveCode
> Subject: Re: revBrowser's htmltext property for Unicode text
> 
> Nevermind, just tried it, doesn't work correctly. innerText doesn't work
either.
> 
> On Fri, Jun 3, 2011 at 6:36 AM, Mike Bonner <bonnmike at gmail.com> wrote:
> 
> > Another option you could try is something like the following
> >
> > *-- uses javascript to place the body of the current page into the tText
> > variable.    *
> > *put
> > revBrowserExecuteScript(sBrowserId,"result=document.body.innerHTML")
> > into tText*
> >
> > and see if javascript sets the result correctly so you can use the text.
> >
> > On Fri, Jun 3, 2011 at 1:45 AM, Mark Schonewille <
> > m.schonewille at economy-x-talk.com> wrote:
> >
> >> Hi Slava,
> >>
> >> This can happen when a website uses (binary) unicode text instead of
> >> html encoded text. Externals can't pass binary data to the LiveCode
> >> engine. As a result, LC gets incorrectly encoded text and text that
> >> cannot be decoded is replaced with question marks.
> >>
> >> Sockets, however, can pass binary data. You could retrieve the data
> >> directly using the put URL command.
> >>
> >> --
> >> Best regards,
> >>
> >> Mark Schonewille
> >>
> >> Economy-x-Talk Consulting and Software Engineering
> >> Homepage: http://economy-x-talk.com
> >> Twitter: http://twitter.com/xtalkprogrammer
> >> KvK: 50277553
> >>
> >> New: Download the Installer Maker Plugin 1.6 for LiveCode here
> >> http://qery.us/ce
> >>
> >> On 3 jun 2011, at 07:11, Slava Paperno wrote:
> >>
> >> > When my revBrowser instance displays a UTF-8 Web page, and I look
> >> > at the value returned by revBrowserGet(instanceID "htmltext"), I
> >> > think all double-byte characters are replaced with question marks.
> >> > I think the
> >> same is
> >> > true of the revBrowser "selected" property.
> >> >
> >> > Could someone please confirm? I don't know enough to be certain,
> >> > and
> >> this
> >> > would make a difference in how I'll proceed with the project.
> >> >
> >> > Thanks,
> >> >
> >> > Slava
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > 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
> >>
> >
> >
> _______________________________________________
> 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