Re: [code] Problem with _CHARSET in Windows

From: Mitchell <m.att.foicica.com>
Date: Sat, 10 Jun 2017 11:12:32 -0400 (EDT)

Hi Giovanni,

Sorry for the horrible delay, but I finally have a Windows 7 VM to test
on.

On Tue, 7 Feb 2017, Giovanni Salmeri wrote:

> Dear Mitchell
>
> I am afraid I have stumbled upon some problems linked to the charset in
> Windows (W10, English American). These are the facts:
>
> 1. _CHARSET is set to CP1252. But in fact the filesystem apparently use
> Unicode for the filenames

Yes, it appears there is a separate character locale for displaying text
that is independent of the filename encoding.

> 2. If I try to save a document with a filename with (for example) greek
> letters, these are transformed in dots and there is a message of
> conversion failed in core/ui.lua:125

I've discovered that this is a side-effect of Lua's usage of the standard
C function `open()`. That function cannot accept unicode filenames. While
Windows provides a unicode-aware version, Lua is not compiled to use it
(or any other unicode-aware variations of standard C functions like
`os.rename()`, `os.execute()`, etc.) It would be quite an effort to
support this.

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.

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 :)

> 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?

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sat 10 Jun 2017 - 11:12:32 EDT

This archive was generated by hypermail 2.2.0 : Sun 11 Jun 2017 - 06:52:28 EDT