[erlang-questions] Validate UTF-8 binary

Marc Worrell <>
Thu Aug 30 10:17:28 CEST 2012


(and now to the list as well)

Hi Zabrane,

Check https://github.com/zotonic/zotonic/blob/master/src/support/z_string.erl
Function: sanitize_utf8/1

- Marc



On 30 aug. 2012, at 10:11, Zabrane Mickael wrote:

> Hi guys,
> 
> I'm looking after a code which can tell if a binary() is UTF-8 valid or not:
> 
> is_utf8_valid(Bin) when is_binary(Bin) -> true;
> is_utf8_valid(Bin) when is_binary(Bin) -> {false, Reason}.
> 
> Something to share?
> 
> Regards,
> Zabrane
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120830/a95e8b06/attachment.html>


More information about the erlang-questions mailing list