Page 1 of 1

uniEncode, uniDecode function

Posted: Tue Mar 03, 2015 12:03 pm
by Jellobus
Hello :D ,

I was using uniEncode, uniDecode function, but I found that it gives a lot of loads to processors. The data I am dealing is not Unicode. it's just english alphabet and numbers. I was wondering if there is function for non-Unicode..so it will have less load to processor. here is my code

Code: Select all

on saveMyCardToDataStack
   set the Text of stack tDataStackPath to uniDecode( unicodeText of fld "saved" of card "saved", "UTF8")
end saveMyCardToDataStack

on restoreMyCardFromDataStack
   set the unicodeText of field "saved" of card "saved" to uniEncode (the Text of stack tDataStackPath, "UTF8")
end restoreMyCardFromDataStack 
Please let me know if anyone knows the function for non Unicode text which has less loads to processor..Thanks a lot in advance!

Louis

Re: uniEncode, uniDecode function

Posted: Tue Mar 03, 2015 1:23 pm
by Klaus
Hi Louis,

sorry, no idea about unicode etc. but you are obviously using a RESERVED word -> TEXT
for the name of a custom property of a stack -> the TEXT of stack xyz

That is asking for trouble and I wonder why LC did not complain so far!?

Use something else like -> the cText of stack XYZ!


Best

Klaus

Re: uniEncode, uniDecode function

Posted: Tue Mar 03, 2015 4:06 pm
by dave.kilroy
Hi Louis

Are you using LC7? If so then RunRev don't want us to use unicodeText, uniEncode or uniDecode anymore...
Important!
As of LiveCode 7.0 the unicodeText property has been deprecated. It will continue to work as in previous versions but shoud not be used in new code as the existing behaviour is incompatible with the new, transparent Unicode handling (the resulting value will be treated as binary data rather than text). This functions is only useful in combination with the also-deprecated uniEncode and uniDecode function.

Re: uniEncode, uniDecode function

Posted: Tue Mar 03, 2015 5:32 pm
by Jellobus
Hi Klaus and Dave,

Sorry it was typo :mrgreen: . I mean it was cText. I am using LC 6.5.2 since I think it is more stable.

I think I found solution.. I was thinking too much.

Code: Select all

on saveTotDatastackPath
    set cText of stack tDatastackPath to field "saved"
end saveTotDatastackPath

on resotreData
     put cText of stack tDatastackPath into field "saved"
end restoreDat 
Do you guise think it is less loads to processor because the data is not Unicode format?

Cheers,

Louis