Re: Problems with jsonToArray and special chars like: æøå

panagiotis merakos merakosp at gmail.com
Wed Jun 6 07:40:31 EDT 2018


Hi Tore,

jsonToArray uses the mergJSON external. The mergJSON external expects the
data passed to JSONtoArray() to be utf-8 encoded (this is the case with any
LC external, such revDB etc).

So something like this should work:

global kommuneArray

on preOpenStack
  put empty into kommuneArray
  put "file:" & specialFolderPath("resources")& "/Kommunedata.txt" into
tFile
  put textEncode(tFile,"UTF-8") into tData
  put jsonToArray(tData) into kommuneArray
end preOpenStack

Best,
Panos
--

On Wed, Jun 6, 2018 at 11:16 AM, Tore Nilsen via use-livecode <
use-livecode at lists.runrev.com> wrote:

> I have run into a problem with jsonToArray and the special Norwegian chars
> æøå. They do not show up in the keys of the array when the array is made
> from an external file. The external file is generated by LiveCode and the
> arrayToJSON function. All text are encoded to “UTF-8” before the array is
> made and passed to arrayToJSON. The script I use to generate the array on
> start up is as follows:
>
> global kommuneArray
>
> on preOpenStack
>
> put empty into kommuneArray
>
> put "file:" & specialFolderPath("resources")& "/Kommunedata.txt" into
> tFile
>
> put textDecode(url tFile,"UTF-8") into tData
>
> put jsonToArray(textDecode(tData,"UTF-8")) into kommuneArray
>
> end preOpenStack
>
>
> The array generated contains all the right information, but keys that
> should include æ, ø or å do not show up correctly. Any ideas anyone?
>
> Best regards
> Tore Nilsen
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the Use-livecode mailing list