On Thu, Apr 9, 2020 at 8:06 AM Klaus major-k via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Hi friends,
>
> this just came up in the german LC forum, obviously "arraytojson"
> does not like UMLUATS in the keynames!?
>
> This:
> ----------------------
> on mouseUp
>  put "eins" into tArray["äns"]
>  put "zwei" into tArray["zwöi"]
>  put arraytojson(tArray)
> end mouseUp
> ----------------------
> gives -> {}
>
> Is this correct/desired behaviour?


Correct? Yes. The data and keys are not UTF-8 encoded.
Desired? No.

Try encoding the keys and data as UTF-8 before passing to arraytojson.
Arraytojson() uses the mergJSON external and requires UTF-8 data.

----------------------
on mouseUp
 put textEncode("eins", "utf8") into tArray[textEncode("äns", "utf8")]
 put textEncode("zwei", "utf8") into tArray[textEncode("zwöi", "utf8")]
 put arraytojson(tArray)
end mouseUp
--------------------—

You can refer to the following report I filed on the current state of JSON
in LiveCode (which is not good). In my work I use both the JSON Library and
mergJSON as described in the report.

https://quality.livecode.com/show_bug.cgi?id=22478

-- 
Trevor DeVore
ScreenSteps

>
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to