More Unicode STuff
Kay C Lan
lan.kc.macmail at gmail.com
Fri Feb 20 02:44:06 CET 2015
On Sat, Feb 14, 2015 at 2:23 AM, Peter Haworth <pete at lcsql.com> wrote:
> My brain is too fried to figure out why this should be so my plan is to
> just always encode/decode stuff when importing/displaying.
Sorry for the slow reply, but I note your other post on your tentative move
to LC 7 and the gotchas along the way, so this additional information will
probably be timely and hopefully explanatory.
This additional Important Note in the LC 7 dictionary under
'uniEncode/uniDecode' will be of interest:
As of LiveCode 7.0 the uniEncode function 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 uniDecode function and unicodeText field property.
Also, as to why you need to do the two way encoding/decoding, it's better
explained in the LC 7 dictionary under the 'textEncoding/textDecoding'
It is highly recommended that any time you interface with things outside
LiveCode (files, network sockets, processes, etc) that you explicitly
textEncode any text you send outside LiveCode and textDecode all text
received into LiveCode. If this doesn't happen, a platform-dependent
encoding will be used (which normally does not support Unicode text).
It is not, in general, possible to reliably auto-detect text encodings so
please check the documentation for the programme you are communicating with
to find out what it expects. If in doubt, try UTF-8.
More information about the use-livecode