Unicode Store in JSON
Sannyasin Brahmanathaswami
brahma at hindu.org
Sun Oct 14 23:31:33 EDT 2018
First can you clarify if both of these should work.? We see both in
dictionary...
*Example*
textEncode("A","UTF16")
*put*textEncode(field"output","UTF-8") intotOutput
will the 2nd param work with or without a hyphen?
-----------
unclarity --simply:
*Syntax*
textEncode(*stringToEncode*, encoding)
*Summary*
Converts from text to binary data.
========
doesn't stipulate an "exception" for
"different libraries that treat JSON text encoding differently. mergJSON [snip] "
BR
On 10/14/18 2:55 PM, Monte Goulding via use-livecode wrote:
> Could you provide some detail where the docs are misleading. It is actually true that you can’t JSON encode binary data.
>
> We do have different libraries that treat JSON text encoding differently. mergJSON and therefore ArrayToJSON and JSONToArray deal with UTF-8 encoded JSON only. ArrayToJSON and JSONToArray will do this encoding for you if you give it text strings. If you give it binary strings then they must be UTF-8 encoded already otherwise mergJSON will throw an error.
>
> JSONImport and JSONExport on the other hand deals with JSON as text so you need to textDecode/textDecode as a separate operation. If you give any LCB API binary strings when it is expecting text strings then it will follow the engine’s standard conversion which will be native encoding (eg ISO/MacRoman).
>
> Note while the previous JSON specs just say unicode encoding can be used RFC8259 specifies UTF-8 encoding of JSON between systems.
>
> Cheers
--
Svasti Astu, Be Well!
Brahmanathaswami
Get the SivaSiva app, it's free:
https://www.himalayanacademy.com/apps/sivasiva
More information about the use-livecode
mailing list