Fast Stringprep implementation for Erlang / Elixir
C Erlang C++ Other
Latest commit 7643cf1 Mar 22, 2017 Christophe Romain Release 1.0.8
Failed to load latest commit information.
c_src Update copyright year (processone/ejabberd#1442) Jan 9, 2017
src Release 1.0.8 Mar 22, 2017
test Make sure the coverage doesn't fall Sep 8, 2016
tools Init Apr 4, 2013
.gitignore More ignored files Nov 27, 2015
.travis.yml Enable Gcov Nov 27, 2015 Release 1.0.8 Mar 22, 2017
LICENSE.ALL Preparing release Nov 27, 2015
LICENSE.TCL Added license information Nov 12, 2013
LICENSE.txt Preparing release Nov 27, 2015
Makefile We need to get deps before compiling Erlang code Nov 27, 2015 Badge need to be using new app name Feb 3, 2016
configure Enable gcov support Nov 27, 2015 Work in progress on coverage support Nov 27, 2015
rebar.config Release 1.0.8 Mar 22, 2017
rebar.config.script Enable gcov support Nov 27, 2015

Fast Stringprep implementation for Erlang / Elixir

Build Status Coverage Status Hex version

Stringprep is a framework for preparing Unicode test strings in order to increase the likelihood that string input and string comparison work.

The principle are defined in RFC-3454: Preparation of Internationalized Strings .

This library is leverage Erlang native NIF mechanism to provide extremely fast and efficient processing.

The library includes support for several Stringprep profiles used in XMPP protocole like:

  • Nodeprep
  • Nameprep
  • Resourceprep

For those profiles, the rules are applied according to RFC6122. The various functions perform check on the allowed / forbidden chars for a given profile or prevent combining left-to-right and right-to-left chars.

It the binary string passed to a function of the API is valid, it will return its normalized version according to Stringprep profile. Otherwise, if the binary string is invalid, for example because it contains invalid chars, the function will return error.

The library is heavily used in XMPP string processing. However, the library is more generally useful in code that need to manipulate and compare Unicode strings.


Fast Stringprep processing tool can be build as follow:

./configure && make

Configure script recognizes one flag - pass --enable-gcov to enable gcov coverage reporting.

It is a rebar-compatible OTP application. Alternatively, you can build it with rebar:

rebar get-deps compile


You can start the application with the command:

$ erl -pa ebin/
Erlang/OTP 18 [erts-7.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V7.1  (abort with ^G)
1> application:start(p1_stringprep).

You can then call any of the stringprep function to apply a profile:




Unit test

You can run eunit test with the command:

$ make test