Altering HTML Text

Ray Horsley Ray at LinkIt.Com
Wed Feb 24 16:25:24 EST 2010


I believe I (we) have this one solved.  As it turns out, the solution  
was three-fold.

First I had to delete the first 3 strange looking characters (I  
believe they're meta-characters) of the html source code.  I was  
tempted to do that early on but was concerned it might break  
something.  It turns out it doesn't seem to do any harm.  I still  
don't understand why they're there.  Something to do with BOM.

Secondly, I had to take care of the partial image paths in the html  
source code.  That's easy with a replace function.

Thirdly, I had to uniDecode the html source code before using  
RevBrowserSet to put it back.  The odd looking command looks like this:
put uniDecode(uniEncode(myHtmlText,"UTF8")) into myHtmlText
This is another thing I don't understand.  Why decode something you're  
encoding at the same time?  Anyway, it works.

It might be a nice addition to Revolution down the road to be able to  
print both native Rev controls, like fields, at the same time you're  
printing browser displays using the RevBrowser stuff.  Then none of  
this would be necessary.

Thanks to Bob, Mark, David, Jim, André, and especially Dave Cragg.   
Dave, you're the man!

Ray


On Feb 24, 2010, at 8:26 AM, Bob Sneidar wrote:

> Dave,
>
> Try inserting a line with the base tag before everything else:
>
> <base href="url to your relative referenced images" />
>
> This will cause the references to be relative to the base you define.
>
> Bob
>
>
> On Feb 24, 2010, at 12:34 AM, Dave Cragg wrote:
>
>> Ray
>>
>> I was able to add a line and redisplay it (almost) by doing  
>> something like this:
>>
>>  put revBrowserGet(gBrowserD, "htmltext") into tHtmlText
>>  replace "</BODY>" with "<p>Extra line</p></BODY>" in tHtmlText
>>  # put empty into char 1 to 3 of tHtmlText  ## not necessary it  
>> seems (removing the utf-8 BOM mark at the beginning)
>>  put uniDecode(uniEncode(tHtmlText, "UTF8")) into tHtmlText
>>  revBrowserSet gBrowserD, "htmltext", tHtmlText
>>
>> I said "almost" because there's a problem with the image in the  
>> html. It uses a relative url (../images/5067210.Jpeg). When you use  
>> revBrowserSet to set the htmltext property, the base url is no  
>> longer the same as when loaded directly from the server. So some  
>> more manipulation of the image src urls would be needed.
>>
>> I notice that the html has the "head" element inside the "body"  
>> element. Although my browser seems happy with that (Safari), it  
>> doesn't seem right.
>>
>> Cheers
>> Dave
>>
>>
>> On 23 Feb 2010, at 21:31, Ray Horsley wrote:
>>
>>> If I use the RevBrowser library handlers to display it in an image  
>>> I can then get the htmlText of the 'instance' using the  
>>> RevBrowserGet() function.  That's where I get strange looking  
>>> characters.  If I then set the htmlText of the same image using  
>>> RevBrowserSet, passing the return I got from RevBrowserGet(), the  
>>> display turns weird.  I'll include, below, a little bit of the  
>>> weird return I get from the RevBrowserGet() function after  
>>> displaying the above URL.
>>>
>>> Thanks,
>>>
>>> Ray
>>>
>>> Ôªø<HTML><BODY><HEAD></HEAD><div style="font-size:14pt; font- 
>>> family: Times; font-weight: bold;text-align:center;"><span  
>>> style="font-size:14pt; font-family: Times; font-weight: bold;text- 
>>> align:center;">Arrowhead Farm</span></div><div style="text- 
>>> align:center;margin-top:0pt;margin-bottom: 1em;"><img src="../ 
>>> images/5067210.Jpeg" width="70" height="191" format="Jpeg" /></ 
>>> div><table style="font-size:12pt; font-family: Times; font-weight:  
>>> normal;"><tr><td style="font-size:12pt; font-family: Times; font- 
>>> weight: normal;vertical-align: top; width: .25in;">1</td><td><div  
>>> style="text-indent: 0.25in;margin-top:0em;margin-bottom: 
>>> 1em;">“Hey, Max, time to wake up,” Mrs. Jensen said. “It’s  
>>> Saturday, our day to visit Grandpa.”</div></td></tr></ 
>>> table><table style="font-size:12pt; font-family: Times; font- 
>>> weight: normal;"><tr><td style="font-size:12pt; font-family:  
>>> Times; font-weight: normal;vertical-align: top; width: .25in;">2</ 
>>> td><td><div style="text-indent: 0.25in;margin-top:0em;margin- 
>>> bottom:1em;">
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list