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.
Character encoding issue
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Character encoding issue
Hi scunnercampbell,
I'm seeing the pound symbol as £ in HTML
  looks like nbsp?
Simon
I'm seeing the pound symbol as £ in HTML
  looks like nbsp?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Character encoding issue
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.
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.
Last edited by n9yty on Thu Mar 21, 2013 2:49 am, edited 1 time in total.
-
- Posts: 3
- Joined: Wed Mar 13, 2013 4:29 pm
Re: Character encoding issue
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.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.
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
Sorry, my bad, I fixed it above... uniEncode/uniDecode not utf... I had a UTF hangover apparently. LoL