octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternati


From: anonymous
Subject: [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json
Date: Sat, 31 Oct 2020 11:28:00 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

Follow-up Comment #28, patch #9980 (project octave):

[comment #26 comment #26:]
> The "invalid UTF-8" error is probably because `regexp` requires UTF-8
encoded input in Octave 6 or newer.
> I guess the input file has a different encoding. In Octave 6 or newer you
can specify the encoding when opening a file with `fopen`. Otherwise you could
use `native2unicode` to convert from whatever input encoding to UTF-8.

I've taken this advice and fixed the input with 'native2unicode' and a
warning.  I can only verify that code did not break, I'm still at a loss to
generate and test against a wrongly encoded string.   In Octave 7, I've tried
writing out and reading back in a JSON string with non-UTF-8 encoding
(including bizzare characters).  I was unable to replicate the `regexp` error
(on Oct 5 or 7), so I can't tell if this fix works.

On the issue of multidim arrays, I think "to/fromJSON" and "jsonencode/decode"
will have to go separate ways. I've updated the HELP doc to reflect this. 
IMHO, Matlab's choice is at best inconsistent and at worst just wrong. Maybe
"to/fromJSON" is wrong too, but I think at least its more consistent.   so...

Files are uploaded ("to/fromJSON_v2_2.m").  I have included some of the big
BIST tests from "jsonencode" and "jsondecode".


(file #50174, file #50175)
    _______________________________________________________

Additional Item Attachment:

File name: toJSON_v2_2.m                  Size:17 KB
    <https://file.savannah.gnu.org/file/toJSON_v2_2.m?file_id=50174>

File name: fromJSON_v2_2.m                Size:20 KB
    <https://file.savannah.gnu.org/file/fromJSON_v2_2.m?file_id=50175>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?9980>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]