Code review comment for lp:~qzhang/lava-dispatcher/fix-unicode-encode-err

Revision history for this message
Spring Zhang (qzhang) wrote :

> Is self.serialio expecting binary strings or unicode strings? Do you do any
> extra manipulation on that string? This code seems to do nothing useful
> because:
No extra manipulation on the string, except the code in this commit. self.SerialIO just catch the output of serial output text and put it to both logfile and StringIO, it doesn't expect unicode or other strings, the exception raises because StringIO can't mix 8bit and Unicode string, but it goes to StringIO if no handling.

>
> 1) Either the serial line expects unicode strings and the world is upside down
> (this is not likely)
We can also encode it by Unicode not Ascii, we can determine it if unicode is more compatible.

> 2) The serial line is happy with any bytes you send it and you just corrupt
> the 8th bit for no good reason.
Exactly for serial line but StringIO won't accept mixed strings. And most characters from serial line are 8bit and StringIO corrupt with a Unicode byte.

« Back to merge proposal