This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't escape and decode network response payloads
Summary: This was originally done in #377 to support chinese characters, but it's not clear how it works, or what problem specifically it is trying to solve. It's causing some problems where valid responses are failing to be "decoded", so I'm removing it. Reviewed By: mweststrate Differential Revision: D22866879 fbshipit-source-id: a19a57b0ddba2b9f434eb3c37e6b92da1dfbef01
- Loading branch information
45d461a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixed is wrong, this PR caused UTF8 characters to not parse properly.
For example, the BASE64 encoding for the character
東京
is5p2x5Lqs
; if you useatob('5p2x5Lqs')
to decode it, you will getæ±äº¬
, which is obviously wrong.The essential reason is that
atob/btoa
does not support conversion between UTF8 characters and BASE64 characters45d461a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa#Unicode_Strings
45d461a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bringing this to our attention, @skychx! Would you mind opening an issue, linking to this commit so our oncall can triage this?
45d461a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've created a new issue detailing the Network parsing problem here.