[code] : [code] : [code] [textadept] Could you please give me advice to configure encoding menu correctly?

From: Outlook Yuki <X1353135.att.outlook.com>
Date: Sat, 29 Jul 2017 06:58:12 +0000

Hi Mitchel

I think the problem is that `io.open_file()` always try to auto detect encoding and user doesn't have any chance to select a apecific encoding by himself for the file.
The solution which I think is to add encoding as argument to `io.open_file()`, and `io.open_file()` load the file according given encoding, or try to auto detect the encoding when null is given as encoding.
If `io.open_file()` behive like above, user has a chance to force select encoding.
Additionally, it's also better to add encoding option(including "auto detect" option) to file open dialog box.

Yuki
________________________________
: Mitchell <m.att.foicica.com>
ʱ: 2017726 2:03:47
ռ: code.att.foicica.com
: Re: [code] : [code] [textadept] Could you please give me advice to configure encoding menu correctly?

Hi Yuki,

On Tue, 25 Jul 2017, Outlook Yuki wrote:

> Hi Mitchell
>
>
>> What you can try to do is manually set `buffer.encoding = 'CP932'` via the command entry, and then try and select the "CP932" encoding from the menu in order to "reset" the display encoding.
>
>
> Thank you for your comment.
> I tried above steps, but same error is shown unfortunately.

Sorry, then I do not know how to best handle this. When Textadept opens a file, it tries to convert its text from an encoding to UTF-8, and then stores the UTF-8 internally. In your case, Textadept opens your CP932 file, assumes it is encoded in CP936, converts that to UTF-8 (which produces no error), and then (inaccurately) marks the file as CP936. Later, if you try to change the file to its correct CP932 encoding, Textadept converts from UTF-8 to CP936, CP936 to CP932, and then CP932 back to UTF-8 for internal storage. However, the CP936 to CP932 conversion fails, presumably because the original, incorrect CP936 to UTF-8 conversion caused an issue.

All of this can be seen in Textadept's *core/file_io.lua* file in the `io.open_file()` and `set_encoding()` functions. Perhaps you will have some idea on how we can fix this.

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.

-- 
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 29 Jul 2017 - 02:58:12 EDT

This archive was generated by hypermail 2.2.0 : Sat 29 Jul 2017 - 06:39:30 EDT