Re: Character encodings for files

Edward Diener <[email protected]>
Newsgroups gmane.editors.jedit.user
Message-ID <[email protected]>
On 11/18/2019 10:50 AM, Dale Anson wrote:
> Unfortunately, there isn't a built-in way to do that, and I'm not aware 
> of a plugin that provides that feature. The jEdit API doesn't really 
> provide a way to set encoding by file type, rather it uses bytes from an 
> input stream and doesn't give access to the file itself, so without an 
> API change, a plugin couldn't do what you're asking.
> 
> I'm assuming you have the auto detect encoding turned on?

Yes, auto detect is turned on. Maybe I should just change the default 
encoding from Cp1252 to UTF8 on Windows.

Ideally it would be nice if I could tell JEdit to automatically use 
encodings based on glob patterns, and use the default encoding whenever 
a glob pattern is not matched. I am assuming in that ideal case that a 
glob pattern might extend to a full file spec so specific directories 
could be part of the pattern.

> 
> Dale
> 
> 
> 
> On Mon, Nov 18, 2019, 7:30 AM Edward Diener <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>     On 11/18/2019 5:31 AM, Moti Ben-Ari wrote:
>      > Use File/Reload with Encoding to use a different encoding for an
>      > individual file.
>      >
>      > Note that there are a large number of encodings which can be a pain
>      > since utf8 is near the end :-(. Go to Utilities/Global
>     Options/Encodings
>      > and drag to Selected encoding(s) the ones you need.
> 
>     I am fully aware that I can open an individual file with a particular
>     encoding using File/Reload with Encoding. But if you read my OP below
>     that is not what I asked about. I want to have the ability to
>     automatically open certain file types as defined by file globs and a
>     file location with an encoding that is not the single default encoding
>     defined by Global Options | Encodings | Default Character Encoding. In
>     other words I find the single default character encoding, applied to
>     all
>     files for which I have not changed to a different encoding, to be a
>     very
>     limited way of specifying what encoding I want for files.
> 
>      >
>      > On Mon, Nov 18, 2019 at 8:03 AM Edward Diener
>     <[email protected] <mailto:[email protected]>
>      > <mailto:[email protected]
>     <mailto:[email protected]>>> wrote:
>      >
>      >     I do not see anything the JEdit settings that lets me control the
>      >     character encoding which certain types of files, or certain
>     types of
>      >     files in certain directories, should be opened with. Does
>     this exist in
>      >     JEdit ? I only noticed a global option for the default
>     encoding. Have a
>      >     I missed something, or does JEdit, or perhaps a JEdit plugin,
>     let me
>      >     control the character encoding with which certain files are
>     opened.
>      >
>      >     While the default encoding under Windows, Cp1252, works well
>     for the
>      >     vast majority of files there are a number of files which
>     should be
>      >     opened with the UTF8 encoding instead. In particular nearly
>     all git
>      >     files in git repositories are UTF8.
>      >
>      >     I did notice that once I changed the character encoding for a
>      >     particular
>      >     file that JEdit retains this even between sessions, so
>     evidently JEdit
>      >     can associate a character encoding with a particular file
>     whenever I
>      >     edit the file. But what I am looking for is the ability to
>     say that all
>      >     the files of a particular file glob within a particular
>      >     directory/subdirectories should be opened with some encoding
>     which is
>      >     not the default encoding.



-- 
-----------------------------------------------
jEdit Users' List
[email protected]
https://lists.sourceforge.net/lists/listinfo/jedit-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.