Page 1 of 1
Problem with Pinning Unicode Tutorial
Posted: Mon Sep 02, 2013 6:53 pm
by AZSun
Hey guys, I've been working on various tutorials but I can't seem to figure this one out. I'm on an intel mac, LiveCode 5.5.3, and I'm stuck. As I walk through the tutorial, all things are good up to step 3.
http://newsletters.livecode.com/august/ ... etter4.php
I have the same fields and use the same message box text, but I get a different number for the backwards Russian R. (Я люблю тебя.) My message box returns 8255 which is not the right number. It should be 1071. I thought it might be since I copy and pasted the demo text from a web page so I typed the œ in sœur from French and it also gives me some strange number. (8399) I think it should be 0153.
I can go to the reverse and use
Code: Select all
set the useUnicode to true
set the unicodeText of fld "russText" to numToChar(1071)
and get the correct symbol in the text field.
Thanks,
Re: Problem with Pinning Unicode Tutorial
Posted: Mon Sep 02, 2013 8:01 pm
by AZSun
While searching for unicode information, I found this hidden gem. The OS X Calculator app in your application folder has a programmer's mode. It does all sorts of converting including showing ASCII or Unicode. Here's where I found a video that runs through the other hex and binary tools.
http://macmost.com/the-versatile-mac-ca ... r-app.html
Re: Problem with Pinning Unicode Tutorial
Posted: Mon Sep 02, 2013 8:07 pm
by Simon
Just writing to confirm this error is true with LC 6.1 and 5.5.
LC 4.6.2 reports the correct number 1071
AZSun, contact
support@runrev.com, they will probably ask you to submit a bug report.
Simon
Re: Problem with Pinning Unicode Tutorial
Posted: Mon Sep 02, 2013 8:21 pm
by AZSun
Thank you Simon, I've been able to wrap my mind around other problems/stopping points I've hit...eventually. This one, however, just was frustrating. I'll see what work arounds there are to playing with unicode text. Maybe I'll try the html converter tools within LiveCode to display the foreign characters.
Re: Problem with Pinning Unicode Tutorial
Posted: Mon Sep 02, 2013 8:36 pm
by Simon
Hi AZSun,
Which version LC did you test this code in?
I didn't try the latest rc4 (?) it may be working in that.
Would you rather have me post the bug?
Simon
Re: Problem with Pinning Unicode Tutorial
Posted: Mon Sep 02, 2013 11:27 pm
by AZSun
Hey Simon, I just did more testing and more weirdness took place. I tested under 5.5.3 and 5.5.1 and no matter the source the reversed R always comes up 8255 on my intel mac.
Well then I thought I'd give it a try on my PowerBook 10.4.11 PPC chip (LiveCode 6.0.2). Then I found the source matters. I copy and pasted from the pinning unicode
http://newsletters.livecode.com/august/ ... etter4.php. This will reliably yield 16160. Then I tried from Devin Asay's page where he also has the same Russian text.
http://revolution.byu.edu/unicode/unicodeInRev.php The source matters here and gives me 40736. On the PCC it seems to matter and on the intel it is always 8255 no matter the source...
With Devin's Text I cannot insert the French œ (option-q on keyboard) I end up with some S like character. The field must be set to use text from the alternate alphabet. With LiveCode's newsletter text, I can insert the œ.
I will try typing more data directly into fields and see where that goes.
I emailed the address you mentioned and will follow up with a report if needed.
Re: Problem with Pinning Unicode Tutorial
Posted: Fri Sep 06, 2013 7:02 am
by AZSun
I received an e-mail with the answer
This lesson is one of our older lessons and as such, contains some elements that
are slightly out of date. This should explain the numtoChar issue you are
experiencing.
It was for pre 5.5
Then, They helped out with the newer version of coding that works and mentioned that they would be updating the lesson. The following is what works.
Code: Select all
set the useUnicode to true
put charToNum(the unicodeText of char 1 of fld "russText")
It does leave me wondering why RunRev would send out this tutorial in a newsletter from 23 August 2013.
Thanks,
Re: Problem with Pinning Unicode Tutorial
Posted: Fri Sep 06, 2013 7:18 am
by Simon
Hi AZSun,
Good there is a solution.
How would one write the opposite "numToChar"?
Simon
Re: Problem with Pinning Unicode Tutorial
Posted: Fri Sep 06, 2013 1:54 pm
by AZSun
Hi, the reverse still works as posted in the old lesson. It was just the charToNum that was misbehaving.
Code: Select all
set the useUnicode to true
set the unicodeText of fld "russText" to numToChar(1071)
The above works to go from a unicode number to a character.
Re: Problem with Pinning Unicode Tutorial
Posted: Sat Mar 29, 2014 12:20 pm
by atout66
I want to thank you AZSun for this topic !
This has saved me a lot of work; exactly what I was looking for...
Re: Problem with Pinning Unicode Tutorial
Posted: Mon Mar 31, 2014 2:12 pm
by atout66
Arght ! I spoke too fast... Doing this in a function or in a button:
Code: Select all
set the useUnicode to true
put charToNum(the unicodeText of last char of fld "leTest") into leTest1
returns me always the number 771 for chars like: ɛ̃, ɔ, ɑ̃, ə, œ̃, ɔ̃.
If I ask the opposite:
Code: Select all
set the useUnicode to true
set the unicodeText of fld "leTest" to numToChar(771)
to see what LC 'see' the field is empty...
This meams I can't even deduce the right number for each letter to correct this
It's really frustrating to find out what's going wrong.
If you have any idea how to proceed, thanks in advance.