On Mon, Feb 26, 2018 at 02:02:05PM +0800, Guoshuai Li wrote:
> >On Sun, Feb 18, 2018 at 08:51:16PM +0800, Guoshuai Li wrote:
> >>It can only receive 4096 bytes of data each time in jsonrpc,
> >>when there are similar and Chinese characters occupy multiple bytes,
> >>it may receive half a character, this time the decoding will be abnormal.
> >>We need to receive the completed character to decode.
> >>
> >>Signed-off-by: Guoshuai Li <[email protected]>
> >Thanks for finding and fixing the problem.
> >
> >I am worried that, with this patch, any genuine encoding errors will be
> >ignored.  For example, bytes 0xc0 and 0xc1 never appear in a valid UTF-8
> >sequence, yet I believe that this code will silently ignore them, along
> >with whatever other data appears along with them.  Do you have an idea
> >for how to deal with that?
> >
> >Thanks,
> >
> >Ben.
> 
> Hello Ben
> 
> I sent a new version:
> https://mail.openvswitch.org/pipermail/ovs-dev/2018-February/344705.html
> But I am not satisfied with it.
> This patch can not solve the received data length is exactly a multiple of
> 4096, and with 0xc0 and 0xc1.
> I do not know how to judge that I have received all the data.
> I think I need more people's help.

It looks like we should be using IncrementalDecoder:
https://docs.python.org/3/library/codecs.html?highlight=decode#codecs.IncrementalDecoder
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to