Page 1 of 1
Using non Roman chars in fields and variables
Posted: Wed Dec 10, 2014 6:09 pm
by ekami
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.
Re: Using non Roman chars in fields and variables
Posted: Wed Dec 10, 2014 6:42 pm
by dunbarx
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
Re: Using non Roman chars in fields and variables
Posted: Wed Dec 10, 2014 10:26 pm
by bn
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
Re: Using non Roman chars in fields and variables
Posted: Thu Dec 11, 2014 12:24 am
by ekami
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.
Re: Using non Roman chars in fields and variables
Posted: Thu Dec 11, 2014 12:25 am
by dunbarx
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
Re: Using non Roman chars in fields and variables
Posted: Thu Dec 11, 2014 12:43 am
by bn
@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">δοκιμή@παράδειγμα.δοκιμή</font></p>
<p><font face="Lucida Grande" size="13" color="#262626" bgcolor="#E7F0F5">我買@屋企.香港</font></p>
<p><font face="Lucida Grande" size="13" color="#262626" bgcolor="#E7F0F5">甲斐@黒川.日本</font></p>
<p><font face="Lucida Grande" size="13" color="#262626" bgcolor="#E7F0F5">чебурашка@ящик-с-апельсинами.рф</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
Re: Using non Roman chars in fields and variables
Posted: Thu Dec 11, 2014 1:22 am
by Mark
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