9.3. Writing macros in various character encodings

Note

This section applies only to TrEd/bTrEd running under Perl 5.8 and higher.

If non-ASCII characters should occur in macro code, it is necessary to indicate the character encoding used. Otherwise TrEd wouldn't be able to translate the non-ASCII characters into an internal Unicode representation. Failing to indicate charset used in macro code can therefore lead to unexpected behaviour of the code and/or fatal run-time errors.

By default, TrEd expects UTF-8 encoded macro code. Any other character encoding must be indicated using #encoding directive, followed by name of the encoding, such as utf-8, iso-8859-1, windows-1256, etc. The encoding indicated by an #encoding directive applies on the macro file strating from the line following the directive to the end of the file or to another #encoding directive occurence, whichever happens first. Encoding directive does not apply to included macro files.

Example 1. Indicating macro character encoding

  (UTF-8 encoded macro code)

#encoding iso-8859-2
  
  (latin-2 encoded macro code)

#encoding utf-8

  (UTF-8 encoded macro code continues)