Page 1 of 1

Character encoding issue

Posted: Wed Mar 20, 2013 4:13 pm
by scunnercampbell
Hi. I'm having a problem trying to use HTMLtext to display HTML entities correctly in my LiveCode app. An example is the British pound sign, which is encoded in the XML file where LiveCode is reading in the data:
E.g £3 is encoded in XML as...
 3

But when displayed in LiveCode with HTMLtext, I get, the "not" symbol before the £:

£3

Another example is right closing quotes, encoded as ’ but displayed as Äô

Is there a way round this? A character encoding setting within LiveCode? The database where the content is stored, before being added to the XML file, has character encoding utf8.

Re: Character encoding issue

Posted: Wed Mar 20, 2013 9:13 pm
by Simon
Hi scunnercampbell,
I'm seeing the pound symbol as £ in HTML
  looks like nbsp?

Simon

Re: Character encoding issue

Posted: Wed Mar 20, 2013 10:15 pm
by n9yty
Try something like:

set the htmlText of field "fieldname" to utfdecode( utfencode( yourTextVar, "UTF8" ) )

UGH: That's what I get for going my bad memory... uniDecode( uniEncode( yourTextVar, "UTF8" ) )

I had UTF on the brain. :)

I think that worked for me, except on Android for some reason.

Re: Character encoding issue

Posted: Thu Mar 21, 2013 12:31 am
by scunnercampbell
n9yty wrote:Try something like:

set the htmlText of field "fieldname" to utfdecode( utfencode( yourTextVar, "UTF8" ) )

I think that worked for me, except on Android for some reason.
Thanks...I tried that, but results in an empty field. Are those functions definitely available? I can't seem to find any docs on them.

set the HTMLtext of fld "F_AttractionsDetail" to utfdecode( utfencode( gAttractionInfo, "UTF8" ) ) -- results in blank field
set the HTMLtext of fld "F_AttractionsDetail" to gAttractionInfo -- results in field populated but with same issues described in first post

Re: Character encoding issue

Posted: Thu Mar 21, 2013 2:50 am
by n9yty
Sorry, my bad, I fixed it above... uniEncode/uniDecode not utf... I had a UTF hangover apparently. LoL