<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">On 14 Jan 2017, 17:00 +0100, Ilya Khaprov <ilya.khaprov@publitechs.com>, wrote:<br /></div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">
<meta name="x_Generator" content="Microsoft Word 15 (filtered medium)" />
<style>
<![CDATA[
<!--
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:x_link, span.x_MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:x_visited, span.x_MsoHyperlinkFollowed
        {color:#954F72;
        text-decoration:underline}
.x_MsoChpDefault
        {}
div.x_WordSection1
        {}
-->
]]>
</style>
<div lang="EN-US" link="blue" vlink="#954F72" xml:lang="EN-US">
<div class="x_WordSection1">
<p class="x_MsoNormal">>> Given that both Erlang and elixir are implemented on top of BEAM, the wheel might not need reinventing?</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Why Elixir implements Unicode in Elixir? You have to rewrite it anyway. </p>
</div>
</div>
</blockquote>
<div><br /></div>
<div>Elixir takes the files directly from unicode distribution, and uses macros to compile them down into regular functions. BEAM is wonderful at optimising bitstring pattern matching, so the resulting code is quite efficient and does not need NIFs. The whole implementation is also about 500 LoC <a href="https://github.com/elixir-lang/elixir/blob/master/lib/elixir/unicode/unicode.ex">https://github.com/elixir-lang/elixir/blob/master/lib/elixir/unicode/unicode.ex</a>, so it's not a monstrosity and the code is quite readable.</div>
<div><br /></div>
<div>On 14 Jan 2017, 16:53 +0100, Oliver Korpilla <Oliver.Korpilla@gmx.de>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">Could the Unicode support in elixir serve as a starting point?<br />
<br />
https://hexdocs.pm/elixir/1.3.3/String.html#content<br />
<br />
String.upcase/1 and String.downcase/1 seem to be Unicode-aware. And a lot of effort seems have gone in scenarios like this:<br />
<br />
"For example, the codepoint “é” is two bytes:<br />
<br />
iex> byte_size("é")<br />
2"<br />
<br />
Given that both Erlang and elixir are implemented on top of BEAM, the wheel might not need reinventing? I know engineers and programmers love inventing stuff, and this discussion seems to point in that direction, but...<br /></blockquote>
</div>
<div><br /></div>
<div>All the functions in the Elixir's String module are unicode aware. There are functions for unicode normalisation (both nfd and nfc) and checking equivalency (e.g. "é" can be a single code point, or two code points - the letter "e" and the combining diacritic acute). String.length/1 works in terms of unicode graphemes (multiple codepoints can compose into a single grapheme):</div>
<div><br /></div>
<div>iex> String.length("é")</div>
<div>1</div>
<div><br /></div>
<div>On 14 Jan 2017, 16:30 +0100, Benoit Chesneau <bchesneau@gmail.com>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">
<div dir="ltr">someone has to write a good binding (non blocking) of icu :) I think it would be easier than reinventing the wheel. i18n [1] was a good start but looks abandoned these days. Also I disliked the load of resources at startup in ETS: <a href="https://github.com/erlang-unicode/i18n">https://github.com/erlang-unicode/i18n</a></div>
</blockquote>
</div>
<div><br /></div>
<div>icu is problematic in the fact that it works mostly with UTF-16.</div>
<div><br /></div>
<div>Michał</div>
</div>
</body>
</html>