<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I’m running into an issue where OSX and Linux seem to treat the command-line arguments to an escript differently. Using the following escript:<div><br></div><div><div>#!/usr/bin/env escript</div><div>%% -*- erlang -*-</div><div>%%! +pc unicode</div><div><br></div><div>main([Args]) -></div><div>    io:setopts([{encoding, utf8}]),</div><div>    io:format("~w~n", [Args]),</div><div>    io:format("~ts~n", [Args]).</div></div><div><br></div><div>Both my OSX and Linux (Ubuntu 13.10) boxes have their LANG set to en_US.UTF-8. I’m running the escript like so:</div><div><br></div><div>./sample.escript سلام</div><div><br></div><div>On OSX, the escript seems to treat `Args` as a list of unicode code-points:</div><div><br></div><div>./sample.escript سلام</div><div>[1587,1604,1575,1605]</div><div>سلام</div><div><br></div><div>On Linux, it seems to treat the input as a list of UTF-8 bytes, where each byte is turned into an integer. The Erlang unicode guide calls this a 'Lists of UTF-8 Bytes' [1].</div><div><br></div><div>./sample.escript سلام</div><div>[216,179,217,132,216,167,217,133]</div><div>سلام</div><div><br></div><div>How does I get both OSX and Linux to treat the input of the escript as a list of code-points?</div><div><br></div><div>Thanks,</div><div>Reid</div><div><br></div><div>[1] <a href="http://www.erlang.org/doc/apps/stdlib/unicode_usage.html">http://www.erlang.org/doc/apps/stdlib/unicode_usage.html</a></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></body></html>