Skip to content

Check FileMustStartWithTextEncoding

github-actions[bot] edited this page Sep 8, 2026 · 2 revisions

file-must-start-with-text-encoding - File should declare its character encoding on the first line

Magik determines a source file's character encoding from a #% text_encoding = ... comment on its first line. When it is missing, the file is read using the session's default encoding, which depends on the locale and can mangle non-ASCII characters such as umlauts. Declaring the encoding on the first line makes the file decode consistently everywhere. Note that the comment is only honoured on the very first line.

Non-compliant Code Example

_package user
_method a.foo() _endmethod

Compliant Code Example

#% text_encoding = utf8
_package user
_method a.foo() _endmethod

Note

This page is generated. Any changes made to this page through the wiki will be lost in the future.

Clone this wiki locally