Text Artifact

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Text Artifact

Post by bidgeeman » Tue Oct 06, 2009 5:17 am

Hello.

I created a little News ticker stack that connects to the internet and downloads a text (.txt) file to a text field.

Code: Select all

on openStack
   put empty into field "News"
   put URL "http://www.errolgray.com.au/News.txt" into field "News"
   end openStack
I sent the stack to a friend and he said that after each word there appeared a box? He showed me a screenshot and there indeed is a little square box after each word.

Can someone shed light on what's happening and how I might get rid of the little boxes?

Cheers
Bidge

dickey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Wed Apr 08, 2009 11:54 pm

Text Artifact

Post by dickey » Tue Oct 06, 2009 6:34 am

G'day Bidge,

Just a thought but perhaps the content from the web is url encoded.

You might try URLDecode before putting the text into your field.

try something like:

Code: Select all

   put empty into field "News" 
   put URL "http://www.errolgray.com.au/News.txt" into varContent
   put URLDecode(varContent) into field "News"
I hope this helps.

Kind regards, Andrew

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Tue Oct 06, 2009 7:14 am

Hi dickey.

Many thanks for the help. I'll see if it works on my friends side and let you know.

Cheers
Bidge

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Tue Oct 06, 2009 7:37 am

Hi.

:(

For some reason that did'nt work dickey....he is still seeing little boxes at the end of each line of text for some reason.

Bidge

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Oct 06, 2009 8:58 am

Hi Bidge,

Can we see the screenshot?
Which operating system does your friend use?
Which operating system do you use?

You might try this:

Code: Select all

on openstack
     put url "http://www.errolgray.com.au/News.txt" into myVar
     if the platform is not "win32" then
          replace crlf with cr in myVar
     end if
     put myVar into fld 1
end openstack
Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Tue Oct 06, 2009 9:29 am

Hello Mark.
Thanks for that. I will try it and see if they are still appearing.

Image
Is this a carriage return error?

I use XP Home 32 bit and I'm sure he has same
as he opened the exe ok.

He is in the US and asleep right now so I will have to wait till tomorrow
to see if it works.

Cheers
Bidge

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Oct 06, 2009 9:37 am

Hi Bidge,

I think what is happening is the following.

You create linefeed-delimited text in a field (the Rev carriage return is actualy a linefeed). You save the text in a text file and Revolution converts the line delimiters to crlf.

If you create a text file directly in Notepad on Windows, the line delimiters will be crlf too.

Now your friend reads the URL. Data from a URL is read as binary, not as text. Therefore, Revolution doesn't convert the crlf back to lf. The remaining carriage returns become visible as squares.

This might also depend on the font being used. Some fonts show a square, other fonts a very tiny space, and yet other fonts may show nothing at all.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Tue Oct 06, 2009 10:54 am

Hi Mark.

Thanks so much for the explanation and the code. It makes senses that it should do the trick. I'll let you know tomorrow.

Many thanks again for the help.

Cheers
Bdge

Post Reply