<div dir="ltr">finally I chosed the easy way:<div><br></div><div><a href="https://github.com/benoitc/hackney_lib/commit/55de7ae0a1f5a0abd5836b52d7cea85951f3c3b8#diff-c8f112ac1af67f0503ac32dff7ae482fR264">https://github.com/benoitc/hackney_lib/commit/55de7ae0a1f5a0abd5836b52d7cea85951f3c3b8#diff-c8f112ac1af67f0503ac32dff7ae482fR264</a><br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 17, 2014 at 5:52 PM, José Valim <span dir="ltr"><<a href="mailto:jose.valim@plataformatec.com.br" target="_blank">jose.valim@plataformatec.com.br</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Oops, talk about me going off-topic. :)<div><br></div><div>There is definitely an issue with the third case, which will be a binary encoded in latin1 or utf-8 depending on the erlang version. The proposed solution will work as long as users give the InEnc explicitly as I don't believe there is a way to retrieve the encoding of the binary. I can't think of any alternative.</div>
<div><br></div><div>I would also change the solution to fail on the second clause. I would rather be explicit the user is passing data in the wrong encoding/format than try to guess it (which may lead to bad guesses).<br>
</div></div>
</blockquote></div><br></div>