Closed homeway closed 9 years ago
Hi,
This actually needs to be done at the framework level rather than at the bridge level. An IOList needs to be transmitted here in order to prevent issues. The main issue is if the user is transmitting binary data (say a dynamically generated image or something), running that binary data through unicode:characters_to_binary/1 will end up either erroring (since it's invalid UTF) or corrupting the contents (if the binary does happen to be encodable as UTF).
I originally thought that this was where it needed to happen to, until I encountered exactly this issue. That's exactly what this test is checking for:
https://github.com/nitrogen/NitrogenProject.com/blob/master/src/tests/tests_disable_encoding.erl
In that, it loads a dynamically generated image of the Nitrogen logo and verifies that the height and width are the expected values.
-Jesse
On Sat, Dec 27, 2014 at 11:34 PM, 青天揽日月 notifications@github.com wrote:
erlang:iolist_to_binary/1 can't work for utf8, instead of it with
unicode:characters_to_binary/1
You can merge this Pull Request by running
git pull https://github.com/homeway/simple_bridge patch-1
Or view, comment on, or merge it at:
https://github.com/nitrogen/simple_bridge/pull/42 Commit Summary
- Update cowboy_simple_bridge_anchor.erl
File Changes
- M src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl https://github.com/nitrogen/simple_bridge/pull/42/files#diff-0 (4)
Patch Links:
- https://github.com/nitrogen/simple_bridge/pull/42.patch
- https://github.com/nitrogen/simple_bridge/pull/42.diff
— Reply to this email directly or view it on GitHub https://github.com/nitrogen/simple_bridge/pull/42.
Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm
Closing this, as it was fixed in Nitrogen.
erlang:iolist_to_binary/1 can't work for utf8, instead of it with unicode:characters_to_binary/1