Strange characters when displaying articles...

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Strange characters when displaying articles...

Post by pTom » Sun Dec 08, 2013 10:36 pm

I took a document I wrote in Word and saved it out as a simple txt file. At this point it read just fine.

Then I uploaded it to the server using Cyberduck. I viewed the file after it was on the server, and it read properly.

Then I looked at the same article as it displayed in my Livecode app and it looks like this:
Swelling with hope, “Lord, give me the chance I have been looking for. Let me do this,” may have been his simple prayer. His name is Ignatius, the bishop of Antioch in the year, AD 107.

Why is it giving me crazy characters like - “ - when it should be giving me just quote marks?

Just so you have complete info, here are all of the symbols I have seen so far:
– - this combination of symbols is for a dash mark (-)
“ - this is combination of symbols is both for a single quote mark and double quotation marks (' & ")
*I don't know of any others but assume there are more! lol

Hope it is a simple fix! Let me know your thoughts!

Thanks!

Tom

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Strange characters when displaying articles...

Post by LCNeil » Mon Dec 09, 2013 11:33 am

Hi Tom,

Do you have a link to one of the text files in question as I would like to test this issue to see if I can replicate it.

Kind Regards

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding

--

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Strange characters when displaying articles...

Post by pTom » Tue Dec 10, 2013 5:16 pm

Just so everyone else knows, the issue I experienced was resolved by understanding the difference between storing and displaying text in Livecode. I don't understand it all but text in computer programming is stored & displayed using Unicode. Specifically related to Livecode:
-the Livecode server stores text docs (.txt) in UTF-8
-Livecode displays text from it's server in UTF-16

So, my issue was resulting from displaying UTF-8 formatted text in Livecode.

What I needed to do (and did thru some research and Neil's instruction!) is convert the UTF-8 from the server into UTF-16 so that it displayed properly in the Livecode app I created. That's it! It was pretty simple! Here is the code (which you need to put int he code that calls for the text to be displayed in the text field) I received from Neil and which you will need to adjust depending on your use and application:

Code: Select all

put url ("file:"&specialfolderpath("desktop")&"/test.txt") into tText
put uniencode(tText, "utf8") into tText
set the unicodetext of field 1 to tText

Post Reply

Return to “idea2app and Coding School”