Re: [code] Problem with _CHARSET in Windows

From: Giovanni Salmeri <>
Date: Mon, 12 Jun 2017 16:18:57 +0200

Dear Mitchell

thank you very much for taking your time for this problem!

> The conclusion here is that on Windows, Textadept can only open files
> with unicode filenames as long as the filename's characters can be
> mapped to the current character set (e.g. CP1252). When this is not
> possible, Textadept raises the 'encoding failed' error, as expected.
> I do not see an easy workaround for this.

An idea: using perhaps one could
do something rather simple like this in ui.lua (NOT tested, I have to
build winapi.dll):

--result = result:iconv(_CHARSET, 'UTF-8')
ok, result = pcall(string.iconv, result, _CHARSET, 'UTF-8')
if not ok then
        require 'winapi'
        result = winapi.short_path(result)

It would be rather ugly beacuse TA would show the 8.3 filename (and it
would require some tweaking more for options.select_multiple) but
perhaps it would work around this limitation. I could experiment a
little and (if it really works) drop a note in the wiki.

> I will point out that Textadept is designed as an editor for
> programmers, and not as a general purpose unicode text editor, so I
> do get a little bit of leeway :)

Yes, but TA in fact *is* a wonderful general purpose text editor, you
are spoling us! :-)

> > 3. If I open TA with a document, and later I try to open another
> > file (with a type associated to TA) with an accented letter in
> > its name, by double-clicking in the file manager, TA crashes
> This is more troubling. I have not been able to reproduce it. Can you
> consistently reproduce this? If so, what is the filename? Can that
> file be blank? Or does it have to have content?

I will do some extensive testing with a vanilla TA (the version I
actually use has a huge init.lua...) and I will send you the results.
Thank you again!

Giovanni Salmeri
You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Mon 12 Jun 2017 - 10:18:57 EDT

This archive was generated by hypermail 2.2.0 : Tue 13 Jun 2017 - 06:52:54 EDT