Do not try to encode binary types as unicode
Review Request #7294 — Created May 8, 2015 and submitted
Previously, when trying to encode the form fields for a request, the
fields were always being encoded as UTF-8, even when they were a binary
type (e.g., unicode text encoded as UTF-8). This lead to encoding
errors and has been rectified.A new unit test has been added to ensure this heaviour does not
regress.
Ran unit tests. The new unit test fails without the rest of this patch
applied.Successfully used the
RBClient
to send requests with fields
containing string values and unicode values.Successfully uploaded a review request that had UTF-8 characters in the
diff, summary, and description.
Description | From | Last Updated |
---|---|---|
""" on the next line. |
chipx86 |
-
This particular change looks fine, but the rest of this file is still acting like we're working with Unicode. We should be using bytestrings everywhere, and never assuming any encoding for anything, I don't think.
We should probably also have unit tests added along with any changes to this, to test various encoding setups.
- Change Summary:
-
Use bytestrings over unicode literals for writing to content.
Add a unit test.
- Description:
-
Previously, when trying to encode the form fields for a request, the
fields were always being encoded as UTF-8, even when they were a binary type (e.g., unicode text encoded as UTF-8). This lead to encoding errors and has been rectified. + + A new unit test has been added to ensure this heaviour does not
+ regress. - Testing Done:
-
~ Ran unit tests.
~ Ran unit tests. The new unit test fails without the rest of this patch
+ applied. Successfully used the
RBClient
to send requests with fieldscontaining string values and unicode values. Successfully uploaded a review request that had UTF-8 characters in the
diff, summary, and description. - Commit:
-
a3310f5b5da21054363d984c62a6a8280f956e6b3dac01519d49d1835e90d09a1daae33501d4bd57
- Diff:
-
Revision 2 (+41 -16)