[erlang-questions] unicode in string literals

Masklinn <>
Tue Jul 31 09:41:44 CEST 2012


On 2012-07-31, at 09:09 , Michael Truog wrote:
> 
> I think the point was to use utf8 in the source file, thus the utf8 in the modeline.  The encoding() would be necessary for various erlang names (like functions, variables, etc.) to be in utf8, but the modeline could help keep list data as utf8.

For what it's worth, Python solved that particular issue (and
redundancy) by adding limited modeline support in the language's
parser[0].

Basically, when parsing a file it looks for the pattern
`coding=<encoding name>` in a comment in the first and second (to
account for shebangs) lines of the file, and if that line is present it
uses the specified encoding for the file.

That avoids the requirement of specifying the encoding for the editor
*and* for the compiler.

[0] http://www.python.org/dev/peps/pep-0263/


More information about the erlang-questions mailing list