Re: [code] Problem with _CHARSET in Windows

From: Mitchell <m.att.foicica.com>
Date: Mon, 12 Jun 2017 22:09:04 -0400 (EDT)

Hi Giovanni,

On Mon, 12 Jun 2017, Giovanni Salmeri wrote:

> 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 https://github.com/stevedonovan/winapi 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'
> winapi.set_encoding(winapi.CP_UTF8)
> result = winapi.short_path(result)
> end
>
> 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.

Yes, that may work, however it would introduce another dependency that I
would prefer not to support and maintain, especially since it is not a
"drop-in" replacement for Lua's `io` and `os` libraries with full
wide-character support.

> [snip]
>
>>> 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!

Okay, thanks. I'll wait for your results.

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 Mon 12 Jun 2017 - 22:09:04 EDT

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