Author Topic: Source file encoding (Unicode, ANSI, etc.)  (Read 9565 times)

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Source file encoding (Unicode, ANSI, etc.)
« on: January 03, 2006, 02:17:40 am »
Applies to 1648 in codeblocks/src

Feel free to test it

Sam

There are some bugs in the patch that was here that are fixed in the patch in the next post. Revert this patch (if you applied it) before applying the next one.

[attachment deleted by admin]
« Last Edit: January 03, 2006, 12:54:27 pm by 280Z28 »
78 280Z, "a few bolt-ons" - [email protected]
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #1 on: January 03, 2006, 12:52:35 pm »
Included feature I didn't mention:
 - Work with files in a specified language (so for example, you can set the highlighter for a .temp file to C/C++ if you want)

Known bugs in the above patch:

 - The "View->Set Highlighter" menu is not disabled when you don't have a source file open. This is fixed in the patch attached to this post.
 - Doesn't detect presence of BOM when opening a file.
 - Always opens in the system default encoding to start with; doesn't try to figure out the encoding based on BOM or presence of lots \x00 characters, even though it could. There is a specific place where this could be improved: cbEditor::DetectEncoding() is called when it needs to be. Implement just that function to add this feature.
 - On some systems (mine at home), the toolbar combo box to select the current highlighter doesn't display. On others (like mine at work), it does.  :?

Included bugfix I didn't mention:
 - If a opened file is externally deleted and the user chooses not to keep it open when Code::Blocks asks, it is closed but not removed from the open files list.
 - When a file in the editor changes it's Modified state, the title bar is not updated with (or to remove) the asterisk indicator.

This patch applies to 1651 in codeblocks/src

[attachment deleted by admin]
78 280Z, "a few bolt-ons" - [email protected]
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #2 on: January 03, 2006, 04:23:44 pm »
shouldn't patches be posted in the patchmanager?
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #3 on: January 03, 2006, 05:35:20 pm »
shouldn't patches be posted in the patchmanager?

Ones that people think should be merged into svn should :)

I'm just trying to get some feedback here, but it ain't happenin'. :o
« Last Edit: January 03, 2006, 05:41:26 pm by 280Z28 »
78 280Z, "a few bolt-ons" - [email protected]
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #4 on: January 03, 2006, 05:50:04 pm »
For me it doesn't add anything usefull (it doesn't matter what kind of encoding I use). But perhaps for people who are using non standard (<- this is standard for me ;)) characters, it could be very usefull....
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #5 on: January 03, 2006, 08:24:55 pm »
I see. Perhaps we can add a "Use non-default encoding" in the preferences, so it displays this menu?

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #6 on: January 03, 2006, 10:40:46 pm »
Right now the "default" is the system default. You could have an option to specify the default.

You could also have an option in the project file to override/specify the default for files in that project. For open development, that would be very useful since the codeset for a project is going to be the same on everyone's computers, but everyone's computers may not have the same default codeset.
78 280Z, "a few bolt-ons" - [email protected]
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #7 on: January 04, 2006, 12:07:34 am »
Ok, here comes the party pooper again...  :lol:

I am against adding all this stuff at the present time (this extension, the "open partner" one, and all similar ones). Not that these aren't good ideas, they are great indeed, but since Yiannis is working on the action-based menu system, this seems like a very bad time to add one new menu after the other.

I don't know about the present state of the actions manager, but I guess it should be 98% done by now - it was almost working weeks ago. So if we keep adding new menus and gadgets now, we will be doing a lot of work twice...

To me, it seems to make more sense if we implement things like this once the new actions manager is up and running (which should only be a week or two, hopefully).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #8 on: January 04, 2006, 12:23:30 am »
But I thought the actions manager was only for the main menu and for keyboard shortcuts.. context menus aren't included, are they?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #9 on: January 04, 2006, 12:28:58 am »
I understood those are included. Would make sense, too.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #10 on: January 04, 2006, 12:41:10 am »
But I thought the actions manager was only for the main menu and for keyboard shortcuts.. context menus aren't included, are they?

Oh yes they are ;)
Be patient!
This bug will be fixed soon...

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Source file encoding (Unicode, ANSI, etc.)
« Reply #11 on: January 13, 2006, 02:11:46 pm »
Ok, here comes the party pooper again...  :lol:

I am against adding all this stuff at the present time (this extension, the "open partner" one, and all similar ones). Not that these aren't good ideas, they are great indeed, but since Yiannis is working on the action-based menu system, this seems like a very bad time to add one new menu after the other.

I don't know about the present state of the actions manager, but I guess it should be 98% done by now - it was almost working weeks ago. So if we keep adding new menus and gadgets now, we will be doing a lot of work twice...

To me, it seems to make more sense if we implement things like this once the new actions manager is up and running (which should only be a week or two, hopefully).

If you would just add them, I can patch them for the new system then. It's not like the concept is going to change, it'll just get a new menu then. You're really digging here.  :?
78 280Z, "a few bolt-ons" - [email protected]
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool: