Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geany does not open files with the default encoding. #900

Closed
ghost opened this issue Feb 10, 2016 · 14 comments
Closed

Geany does not open files with the default encoding. #900

ghost opened this issue Feb 10, 2016 · 14 comments

Comments

@ghost
Copy link

ghost commented Feb 10, 2016

Hi.
OS: Windows 7 64bits
Geany version: 1.26

In "Edit>Preferences>Files>Encodings" I selected IBM850 as default encoding in all options, new files and open files, but all files are opened with 1252 encoding. With new files there is no problem.

Thank you.

@elextr
Copy link
Member

elextr commented Feb 10, 2016

I presume you checked "Use fixed encoding when opening non-unicode files"?

@ghost
Copy link
Author

ghost commented Feb 10, 2016

Yes, is checked.

@codebrainz
Copy link
Member

If you have selected both the "default encoding" combo boxes in Prefs->Files page, what if you select an explicit encoding in the Open File dialog (options at the bottom)? If this doesn't work or shows an error I think there's a bug in the file's encoding or else in GLib converter.

@ghost
Copy link
Author

ghost commented Feb 10, 2016

Hi.
The encoding option in Open File dialog works fine, the file is open with selected encoding.

@elextr elextr added the bug label Feb 10, 2016
@InfoLibre
Copy link

InfoLibre commented Mar 20, 2023

I don't know if it's the same bug but I save the joined file with IBM850 encoding and each time I open it, the encoding is ISO-8859-1 and some characters are wrong like ê that becomes �.
It's like Geany doesn't detect the right encoding.

LISEZMOI.TXT

Geany version 1.38 under Linux Mint Cinnamon 22.1.

@elextr
Copy link
Member

elextr commented Mar 20, 2023

You need to set the encoding manually, with only a couple of non-ASCII characters its impossible to automatically detect the encoding accurately, several encodings are possibly valid, so when several encodings are valid the choice is arbitary.

On the open dialog More Options->Set encoding->West European->IBM 850

@InfoLibre
Copy link

I did it: menu Document - Define encoding - West european - IBM 850 but ê that became � remain � on screen, it doesn't become ê.

@elextr
Copy link
Member

elextr commented Mar 20, 2023

No, on the Open dialog, not Documents menu.

Geany manipulates all documents as UTF-8 internally, encodings only have any effect on loading or saving the document.

The Document->Set encoding->... sets the encoding to save the document as, it has no effect on the UTF-8 in memory.

@elextr elextr removed the bug label Mar 20, 2023
@InfoLibre
Copy link

OK, I found it, it was hidden by default. Thank you.
Would it be interesting if encoding have effect on screen (not only when saving the document) when it is set in Document->Set encoding->... too?

@InfoLibre
Copy link

InfoLibre commented Mar 20, 2023

The problem is when I open the file with double-clicking on it. It is automatically opened by Geany with the wrong encoding.

@InfoLibre
Copy link

InfoLibre commented Mar 20, 2023

A solution could be having the possibility to choose both encoding on screen and when saving, separately.

@elextr
Copy link
Member

elextr commented Mar 20, 2023

There is no "encoding on screen", the file is converted to UTF-8 when its loaded, it is then closed, no non-UTF-8 artefact remains.

The encoding in memory is always going to be UTF-8, Geany is an IDE, its use-case is editing code (all coding languages are covered by UTF-8) and documentation (and all human languages are covered by UTF-8). Having different encodings in memory makes all the operations of the IDE difficult, and pretty much impractical.

The only thing that may have non-UTF-8 encoding is the file on disk, and the only time that is relevant is reading and writing the buffer in memory, so thats when encoding happens.

You can reload the file with a different encoding File->Reload As->..., but you can't change the encoding in the buffer.

Unfortunately there is no solution to the double click problem, there is no command line option to set encoding, and even if "somebody" added one (pull requests are welcome) that just likely means every file is going to be opened with the encoding you teach Nemo to use by setting the option on the command it uses for txt files.

@InfoLibre
Copy link

InfoLibre commented Mar 20, 2023

Thank you for your explanations. File->Reload As->... is a good solution for me, I didn't know that.

@elextr
Copy link
Member

elextr commented Mar 21, 2023

Fundamental operation, won't change.

Both OP and recommentor have workarounds.

@elextr elextr closed this as completed Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants