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!
put uniDecode (the unicodetext of field "h_namn" of stack "fotboll_installningar", "UTF8") after xml
I tried to just change word fld to btn but i guess that is totally wrong..
Here is what im talking about, in my buttons you can see the letters but in my template they dont show. But if i but those names in a field they will show
Buttons are containers, just like fields. Your handler likely works fine, but you are not seeing what is really happening. Try this. Make a button on a new card. In the message box:
put "5" into btn 1
add 1 to btn 1
answer btn 1
Now where is that "6"? It is in button 1 just as if it was in a field. But you do not see it, because buttons don't work exactly like fields do. What you really want is to deal with the label of that button. Different property:
If you are using LC 7 you don't need to use unidecode. LC 7 automatically works with any character set. Just set the label to the Scandinavian string normally, just as though it were Roman text. The same is true for the XML template.
The only time you need to manage unicode translation is when you are exporting or importing text outside of LC. In those situations use textEncode and textDecode.
All the older unicode text properties are deprecated now. They are still available for legacy stacks but are not necessary for new work.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
You do not see the 5 or the 6, because the contents of a button are not visible. But they are there, since the button is a valid container.
So buttons have labels, which are visible. They may contain data, which is invisible. Fields have labels, but they are invisible. Then may contain data, which is visible.
I understand that, im using the label in other functions. But now when im trying to show the label of the button in my template it does not show the Scandinavian letters or other not roman letters.
I use LC7, in LC it shows the letters but its when im sending the data to a template it gets wrong.
These two functions replace the old uniEncode and uniDecode functions. You only need to use them when importing or exporting text to a non-LiveCode destination.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
put "<componentData id=\" after xml
put quote after xml
// Flashbox
put "h_spelare1\" after xml
put quote after xml
put "><data id=\" after xml
put quote after xml
put "text\" after xml
put quote after xml
put " value=\" after xml
put quote after xml
//Field Livecode
put uniDecode (the unicodetext of the label of btn "h_in", "UTF8") after xml
put "\" after xml
put quote after xml
What do you do with the xml text? Do you use it only in LiveCode? Are you writing the xml to a file? The script shouldn't use uniDecode when creating the xml:
put "<componentData id=\" after xml
put quote after xml
// Flashbox
put "h_spelare1\" after xml
put quote after xml
put "><data id=\" after xml
put quote after xml
put "text\" after xml
put quote after xml
put " value=\" after xml
put quote after xml
//Field Livecode
put the label of btn "h_in" after xml -- use this text normally
put "\" after xml
put quote after xml
If you save the xml to a text file on disk, use the textEncode function before writing the file and use textDecode when reading the file. If you are saving the template in the stack, you don't need to do anything special with the text, it is already in the correct format for LiveCode.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
hi im not writing a xml thats just instead of myvariable (just a text) when i was learning livecode a guy showed my a bit of code and i kept useing that "xml".
As i wrote, im sending this text to a flash template.
When i use it like you told me "put the label of btn" my letters as å,ä,ö does not show but everything els show so fot example if i write "Igår" it shows "Igr" in the template. But i LC i see all the letters
usually i would write this if it was a fld and it works perfekt... put uniDecode (the unicodetext of field "name of fld", "UTF8") after myVariable