From 300c5466a7c9cfe3ed22bba2a88ba21058406402 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Thu, 4 Oct 2012 15:58:26 +0200 Subject: [stdlib, kernel] Introduce Unicode support for Erlang source files Expect modifications, additions and corrections. There is a kludge in file_io_server and erl_scan:continuation_location() that's not so pleasing. --- lib/stdlib/doc/src/epp.xml | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'lib/stdlib/doc/src/epp.xml') diff --git a/lib/stdlib/doc/src/epp.xml b/lib/stdlib/doc/src/epp.xml index 386ed89fe1..3e8aba2e5f 100644 --- a/lib/stdlib/doc/src/epp.xml +++ b/lib/stdlib/doc/src/epp.xml @@ -37,6 +37,18 @@

The Erlang code preprocessor includes functions which are used by compile to preprocess macros and include files before the actual parsing takes place.

+

The Erlang source file encoding is selected by a + comment in one of the first two lines of the source file. The + first string that matches the regular expression + coding\s*[:=]\s*([-a-zA-Z0-9])+ selects the encoding. If + the matching string is not a valid encoding it is ignored. The + valid encodings are Latin-1 and UTF-8 where the + case of the characters can be chosen freely. Examples:

+
+%% coding: utf-8
+%% For this file we have chosen encoding = Latin-1
+%% -*- coding: latin-1 -*-
@@ -46,6 +58,9 @@

Handle to the epp server.

+ + +
@@ -82,6 +97,50 @@ included as a "form".

+ + + Return the default encoding of Erlang source files + +

Returns the default encoding of Erlang source files.

+
+
+ + + Return a string representation of an encoding + +

Returns a string representation of an encoding. The string + is recognized by read_encoding/1,2 and + set_encoding/1 as a valid encoding.

+
+
+ + + + Read the encoding from a file + +

Read the encoding from + a file. Returns the read encoding, or none if no + valid encoding was found.

+

The option in_comment_only is true by + default, which is correct for Erlang source files. If set to + false the encoding string does not necessarily have to + occur in a comment.

+
+
+ + + Read and set the encoding of an IO device + +

Reads the encoding from + an IO device and sets the encoding of the device + accordingly. The position of the IO device referenced by + File is not affected. If no valid + encoding can be read from the IO device the encoding of the + IO device is set to the default encoding.

+

Returns the read encoding, or none if no valid + encoding was found.

+
+
Format an error descriptor -- cgit v1.2.3