Re: [code] [textadept] Encoding and display

From: Mitchell <>
Date: Wed, 24 Jul 2019 21:37:52 -0400 (EDT)


On Wed, 24 Jul 2019, Qwerky wrote:

> Hi Mitchell,
> Thanks.  Don't know how I missed the status bar display of encodings!
> Anyway, I added the line " io.encodings[#io.encodings + 1] = 'CP1252' " to my
> init.lua, following the example in the api, and reset, but when opening my
> file, it wasn't auto-detected?

You can try making it the first encoding tried after UTF-8:

   table.insert(io.encodings, 2, 'CP1252')

Textadept tries detecting encodings in order. As soon as it finds an encoding that doesn't throw an error, it assumes the encoding is "correct". However, the human eye may discern it is not correct, but Textadept wouldn't know it :)

Encoding detection is a very tricky thing that is hard to get right. Sure, Textadept could employ the help of a multi-megabyte library whose sole job is to identify the encoding of a chunk of text thrown at it, but that is not very minimalist! Anyway, we've mostly settled on UTF-8 and UTF-16 for most text, and ASCII and ISO-8859-1 for programming languages. That's why Textadept looks for them primarily.


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Wed 24 Jul 2019 - 21:37:52 EDT

This archive was generated by hypermail 2.2.0 : Thu 25 Jul 2019 - 06:33:58 EDT