Bug 125417 - Per project charset selection
Summary: Per project charset selection
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-12 12:23 UTC by Niels
Modified: 2007-08-04 10:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niels 2006-04-12 12:23:27 UTC
Version:            (using KDE KDE 3.5.2)
Installed from:    Gentoo Packages

I have a lot of PHP projects, some in utf8, some in 8859-1. If I forget to change the global editor setting in Kdevelop, I risk losing special chars in files when I save them. It's a *big* problem when that happens!

The best solution would IMO be to be able to select charset in the project settings.
Comment 1 Jens Dagerbo 2006-04-13 01:57:45 UTC
This is a nasty issue, and something we probably need to look at for KDE4/KDevelop4. The editor is a plugin, and today I'm not sure we can even affect its encoding setting from KDevelop.
Comment 2 Anders Lund 2006-04-13 11:16:31 UTC
You could use the .kateconfig file (which contains kate variables line) could 
provide that, or you could use the KTextEditor encodinginterface inside 
kdevelop if you wanted to implement it in code.

The .kateconfig file is searched for in the current directory and in a 
configurable number of above directories, and would in your case contain 
something like

kate: encoding iso8859-1;

Read on here: http://drupal.kate-editor.org/article/.kateconfig

For more about kate variables, contain the manual 
(http://docs.kde.org/stable/en/kdebase/kate/config-variables.html) or read 
the article at http://drupal.kate-editor.org/article/katepart_modelines

-anders
Comment 3 Jens Dagerbo 2006-04-15 01:39:48 UTC
Thanks for the info, Anders!

A solution is implemented in KDevelop 3.4 branch:

* Improved support for encodings
  # KDevelop will now obey the selected encoding in the File Open dialog
  # The OpenWith plugin now offers all available encodings in "Open As" 
  # The encoding for each open file is saved with the session, and will
    be used to open that file the next time the project is loaded
  # Default encoding can be set per project in the Project Options - 
    this will be the default when opening a file
  # File Open encoding will default to the open project's default
Comment 4 Niels 2006-04-18 14:08:44 UTC
Thanks a lot, I appreciate your answers!
Comment 5 Michael 2007-08-01 10:23:01 UTC
I would like to add an additional suggestion here.  It would be very nice if Kate simply did not change sections of the current file which the user has not edited in that session, even if Kate is editing in Utf-8 mode and the file contains invalid Utf-8.  Since Kate uses Utf-8 by default, the current solution is still likely to cause problems for people who do not pay too much attention (or who select "Edit with Kate" from the context menu in Konqueror!) and assume that Kate is 8-bit clean.
Comment 6 Michael 2007-08-01 10:25:53 UTC
Or to put it another way, if Kate did not remove invalid Utf-8 from the file being edited unless the user explicitly deleted it using delete/backspace/whatever.
Comment 7 Amilcar do Carmo Lucas 2007-08-01 11:27:06 UTC
Michael, please open a bug report to KATE. The stuff you said has nothing to do with KDevelop.
Comment 8 Andreas Pakulat 2007-08-03 18:17:26 UTC
I thought I already assigned this to kate earlier...

For what its worth: Its close to impossible for kate to not alter invalid UTF-8 to make it valid, because else it couldn't open the file in the first place. IMHO its perfectly Ok to remove invalid UTF-8, else you might fall into much worse traps when doing something with that file with other tools. IMHO the real bug is in the application that produced the invalid UTF-8 in the first place.
Comment 9 Maciej Pilichowski 2007-08-03 21:34:53 UTC
Andreas, take a look at the original report, not the comments -- kate does not have much to do with it. It is really useful to set it once for good, that this project uses that encoding.
How it could be done in kate? It knows nothing about KDevelop projects not mentioning appropriate configuration per project.
Comment 10 Andreas Pakulat 2007-08-03 22:07:47 UTC
Absolutely right. Sorry for the noise, dunno what I was thinking (probably didn't read the title). Reassigning to kdevelop and removing kwrite-devel from the CC's.
Comment 11 Maciej Pilichowski 2007-08-03 23:09:22 UTC
Btw. is the status FIXED valid? In 3.4.1 I see no option for this in project options.
Comment 12 Andreas Pakulat 2007-08-04 10:17:48 UTC
The status is valid, the option is on the General Page, at the bottom.