Closed ben221199 closed 1 year ago
So that's an error originating from the encoder package. All it's doing is calling json_encode($value)
and that is returning false
i.e. PHP is failing to JSON encode the value you're providing, rather than this package failing to encode it.
My question for you is - can you get PHP's json_encode()
to work with the value you're trying to put into the JSON? If so, can you share the flags that you're using to get it to work. If you can't get it to work, then there's not really much I can do as it's a PHP thing!
FYI utf8_encode
is deprecated. My guess (though haven't tried anything) is you'd need to base64 encode the value.
I removed my utf8_encode
calls from my model function getDNSDataAttribute
, so that my model and other inside code work with GOOD values instead of UTF-8 encoded malformed data. However, in order to get the API working and have \uXXXX
in my JSON output, I had to add utf8_encode
to my resource object RecordResource
and my schema RecordSchema
. I also wrote some custom code with json_encode
(when I substituted DataResponse
temporary) and also had to add utf8_encode
on an array item.
Whenever I transport binary data I convert it to base64 format.
Yeah base64 would seem like the sensible approach.
@ben221199 I'm going to close this issue. That exception is caused by json_encode()
failing, which I can't do anything about.
Hello @lindyhopchris,
At the moment I'm implementing DNSSEC in my DNS system using an API. Logically, there will be binary data and this data isn't neccesary UTF-8. However, when encoding, it only works when I use
utf8_encode()
on my binary data, else it will give me the following error:Is there any fix for this? I don't need my data UTF-8 encoded. JSON is capable to encode byte sequences too.