<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Module proper_unicode</title> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc"> </head> <body bgcolor="white"> <div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div> <hr> <h1>Module proper_unicode</h1> <ul class="index"><li><a href="#description">Description</a></li><li><a href="#types">Data Types</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Unicode generators for PropEr. <p>Copyright © 2014 Motiejus Jakstys</p> <p><b>Version:</b> Sep 22 2018 19:52:29</p> <p><b>Authors:</b> Motiejus Jakstys.</p> <h2><a name="description">Description</a></h2><p>Unicode generators for PropEr</p> <p>This module exposes utf8 binary generator.</p> <p>Makes it easy to create custom-encoded unicode binaries. For example, utf16 binary generator:</p> <pre> utf16() -> ?LET(S, utf8(), unicode:characters_to_binary(S, utf8, utf16)).</pre> <p>Verify it has at least twice as many bytes as codepoints:</p> <pre> ?FORALL(S, utf16(), size(S) >= 2*length(unicode:characters_to_list(S, utf16))).</pre> Only utf8 generation is supported: <a href="#utf8-0"><code>utf8/0</code></a>, <a href="#utf8-1"><code>utf8/1</code></a>, <a href="#utf8-2"><code>utf8/2</code></a>. Unicode codepoints and other encodings are trivial to get with utf8 generators and <a href="unicode.html"><code>unicode</code></a> module in OTP. <h2><a name="types">Data Types</a></h2> <h3 class="typedecl"><a name="type-nonnegextint">nonnegextint()</a></h3> <p><pre>nonnegextint() = non_neg_integer() | inf</pre></p> <h2><a name="index">Function Index</a></h2> <table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#utf8-0">utf8/0</a></td><td>utf8-encoded unbounded size binary.</td></tr> <tr><td valign="top"><a href="#utf8-1">utf8/1</a></td><td>utf8-encoded bounded upper size binary.</td></tr> <tr><td valign="top"><a href="#utf8-2">utf8/2</a></td><td>Bounded upper size utf8 binary, <code>codepoint length =< MaxCodePointSize</code>.</td></tr> </table> <h2><a name="functions">Function Details</a></h2> <h3 class="function"><a name="utf8-0">utf8/0</a></h3> <div class="spec"> <p><pre>utf8() -> <a href="proper_types.html#type-type">proper_types:type()</a></pre></p> </div><p>utf8-encoded unbounded size binary.</p> <h3 class="function"><a name="utf8-1">utf8/1</a></h3> <div class="spec"> <p><pre>utf8(N :: <a href="#type-nonnegextint">nonnegextint()</a>) -> <a href="proper_types.html#type-type">proper_types:type()</a></pre></p> </div><p>utf8-encoded bounded upper size binary.</p> <h3 class="function"><a name="utf8-2">utf8/2</a></h3> <div class="spec"> <p><pre>utf8(N :: <a href="#type-nonnegextint">nonnegextint()</a>, MaxCodePointSize :: 1..4) -> <a href="proper_types.html#type-type">proper_types:type()</a></pre></p> </div><p><p>Bounded upper size utf8 binary, <code>codepoint length =< MaxCodePointSize</code>.</p> <p>Limiting codepoint size can be useful when applications do not accept full unicode range. For example, MySQL in utf8 encoding accepts only 3-byte unicode codepoints in VARCHAR fields.</p> If unbounded length is needed, use <code>inf</code> as first argument.</p> <hr> <div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div> <p><i>Generated by EDoc</i></p> </body> </html>