Using non Roman chars in fields and variables

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
ekami
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 27
Joined: Tue Jun 05, 2012 4:08 pm

Using non Roman chars in fields and variables

Post by ekami » Wed Dec 10, 2014 6:09 pm

Hello from France.
I have a simple field, font used: Helvetica ( Os X)
When i paste text with in greek japanese, arabic..., the text is pasted and shows correctly
exemples:

δοκιμή@παράδειγμα.δοκιμή
我買@屋企.香港
甲斐@黒川.日本
чебурашка@ящик-с-апельсинами.рф

when i copy the field in a variable, or just put a line of this field to another field,all the non roman chars are replaced with "?"

So, how can i know this field contains non roman chars ?

Cordialy, Joan.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Using non Roman chars in fields and variables

Post by dunbarx » Wed Dec 10, 2014 6:42 pm

Are you using v.7, which supports unicode?

I am out of my depth here, but the little I know makes me think this will address your issues.

Craig Newman

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Using non Roman chars in fields and variables

Post by bn » Wed Dec 10, 2014 10:26 pm

Hi Joan,

supposing you are using a LiveCode version < 7

You see the non-Roman characters when pasting because Livecode uses the html of the pasting.

If you want to keep non-roman characters when putting them into a variable use the htmlText

Code: Select all

put the htmlText of field "myField1" into tMyVariable

Code: Select all

set the htmlText of line x of field "myField2" to line 2 of tMyVariable
note how you need to "set the htmlText" because it is a property of the field.

Code: Select all

set the htmlText of line x of field "myField2" to the htmlText of line x of field "myField1"
if you want to see the htmlText of field "myField1" then

Code: Select all

put the htmlText of field "myField1" into field "lookAthtmlText"
Kind regards
Bernd

then you can edit the code in field "lookAthtmlText" and send it back to field "myField1" by

Code: Select all

set the htmlText of field "myField1" to field "lookAthtmlText"
all code tested with your example non-roman text from this post

All this gets complicated and as Craig said in LC 7 and above you should not have to do all this

Kind regards
Bernd

ekami
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 27
Joined: Tue Jun 05, 2012 4:08 pm

Re: Using non Roman chars in fields and variables

Post by ekami » Thu Dec 11, 2014 12:24 am

Hello.
Thanks for your reply.
Maybe i use the htmlText, but i need doing more than copying lines of htmlText in variables ( i must filter chars from non roman alphabets, so i probably need using unicode functions too)
I still use LC 6.6.2 because LC 7 rc2 runtimes are catastrophic under Windows ( XP and seven under //Desktop 8 on Mac) and crash systematically after launching.
And the rendering of the Windows runtimes created with LC 7 are horrible.
Well, nothing works with LC 7 Windows runtimes....
So for the moment i must stay with LC 6 and i plan to abandon LC promptly if the huge bugs of version 7 are not resolved.
Cordially, Joan.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Using non Roman chars in fields and variables

Post by dunbarx » Thu Dec 11, 2014 12:25 am

Bernd.

I thought of advising using the htmlText, but was not sure of myself. I have used that, but only to maintain style properties. This will also keep non-ASCII chars intact as well?

Craig

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Using non Roman chars in fields and variables

Post by bn » Thu Dec 11, 2014 12:43 am

@Craig,
yes, because they are in the form of html and that is all ASCII
e.g.

Code: Select all

<p><font face="Lucida Grande" size="13" color="#262626" bgcolor="#E7F0F5">&delta;&omicron;&kappa;&iota;&mu;&#942;@&pi;&alpha;&rho;&#940;&delta;&epsilon;&iota;&gamma;&mu;&alpha;.&delta;&omicron;&kappa;&iota;&mu;&#942;</font></p>
<p><font face="Lucida Grande" size="13" color="#262626" bgcolor="#E7F0F5">&#25105;&#36023;@&#23627;&#20225;.&#39321;&#28207;</font></p>
<p><font face="Lucida Grande" size="13" color="#262626" bgcolor="#E7F0F5">&#30002;&#26000;@&#40658;&#24029;.&#26085;&#26412;</font></p>
<p><font face="Lucida Grande" size="13" color="#262626" bgcolor="#E7F0F5">&#1095;&#1077;&#1073;&#1091;&#1088;&#1072;&#1096;&#1082;&#1072;@&#1103;&#1097;&#1080;&#1082;-&#1089;-&#1072;&#1087;&#1077;&#1083;&#1100;&#1089;&#1080;&#1085;&#1072;&#1084;&#1080;.&#1088;&#1092;</font></p>
this is the example Joan posted

@Joan,
try with the latest release candidate to see the progress. Livecode is actively fixing bugs and improving speed. It is not yet up to speed with version < 7 but for many things it might well be fast enough.

http://downloads.livecode.com/livecode/

currently LC 7.0.1 RC 3 is the latest version.
RC3 means it is not yet fully released, it is a Release Candidate. So don't build your final app with it. Just test it. And if you find crashes try to reproduce them in a systematic manner and go over to Quality Control Center and bug-report them. They need to know and want to get this out as stable and smooth as possible.

http://quality.runrev.com

I think it is worth the wait.

You can do all the unicode stuff in versions below 7 but it is a pain. Aside from using htmlText I avoid unicode and am lucky that I don't have to use it.

Kind regards
Bernd

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

Re: Using non Roman chars in fields and variables

Post by Mark » Thu Dec 11, 2014 1:22 am

Hi Joan,

Please don't use htmlText for this task. You're dealing with unicode, so use the unicode properties and functions. I selected and copied the sample text from your first message and ran the following script:

Code: Select all

on mouseUp
     put the clipboarddata["unicode"] into myVar
     set the unicodeText of fld 1 to myVar
end mouseUp
which displays the text in the first field. Just as an example, I also executed this:

Code: Select all

on mouseUp
     if the selectedtext of fld 1 is not empty then
          put the unicodeText of the selectedChunk into myVar
          set the unicodeText of fld 2 to the unicodeText of fld 2 & myVar
     end if
end mouseUp
which copies the selected text from the first field to the end of the second field.

What do you need exactly?

Kind regards,

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

Post Reply