UTF-8

Ray Horsley ray at linkit.com
Sun Sep 11 18:23:12 EDT 2011


Mark,

Many thanks for this help.  I believe my challenge is that my encoded text is actually wrapped in html.  For example, after setting the htmlText of a field, this:

<div><object type="text/html" data="passages/3167.htm"/></div><span class="class1"><b>Read the following line from the poem.<br/><br/></b></span><span class="class1"><span class="class1">You&#x2019;ve <u>disturbed</u> a mighty river just by dropping in a stone.</span><br/><br/></span><span class="class1"><b>What does the Latin root <i>turbare</i> mean as used in the word <u>disturbed</u>?</b></span>

produces this:

Read the following line from the poem.You&#x2019;ve disturbed a mighty river just by dropping in a stone.What does the Latin root turbare mean as used in the word disturbed?

Can I operate on this entire chunk of html text or do I need to dig out pieces like "You&#x2019;ve" and uniDecode them?

Many thanks,

Ray Horsley
LinkIt! Software


On Sep 11, 2011, at 4:14 PM, Mark Schonewille wrote:

> Hi Ray,
> 
> Yes. To display UTF8, you need to convert it to UTF16 before setting the unicodeText of a field. You can also convert the unicodeText of a field to UTF8 before writing it to a file. The functions are
> 
> -- convert from UTF8 to UTF16
> uniEncode(myUTF8,"UTF8")
> 
> -- convert from UTF16 to UTF8
> uniDecode(myUTF16,"UTF8")
> 
> To convert from plain text to UTF8 you can do this:
> 
> uniDecode(uniEncode(myEnglish,"ANSI"),"UTF8")
> 
> --
> Best regards,
> 
> Mark Schonewille
> 
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
> 
> Send me a friend request on Facebook if you like https://www.facebook.com/marksch
> 
> On 11 sep 2011, at 23:57, Ray Horsley wrote:
> 
>> Hi all.  Does Livecode have a way to handle UTF-8 encoding and decoding?
>> 
>> Ray Horsley
>> LinkIt! Software
> 
> 
> _______________________________________________
> 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