Bug report: Editor saves empty source code files

Discussion about CodeLite development process and patches
Fred
CodeLite Enthusiast
Posts: 43
Joined: Mon Jul 02, 2012 12:53 pm
Genuine User: Yes
IDE Question: C++
Contact:

Bug report: Editor saves empty source code files

Post by Fred »

When a source code file in the editor contains special unusual characters, an empty file will be written on the next file save action.
So your previous code file is overwritten with an empty file, but you can still see the code in the editor tab, if it is open.
This happens automatically when building or when you save the file by the save command, without any warning or message.
When building, the empty file is compiled to an object file without any code and data. When this is passed to the linker, it will not find the code and data and complain about undefined references.

CodeLite rev. 5770, wxWidgets 2.9.4
Global editor preferences: file font encoding: ISO-8859-1 (not UTF-8, because I use Windows API directly).
But I have to process UTF strings, too.

Sample (g++ console project):

Code: Select all

#include <stdio.h>

int main(int argc, char **argv)
{
	printf("Grüße!\n"); // in UTF-8 "Grüße!"
	return 0;
}
The problem is caused by the UTF-8 in the comment, also would be with

Code: Select all

const char* utf8Greetings =  "Grüße!";
Imo the expected behavior of the editor should be to treat the üß as usual ISO-8859-1 characters (my encoding setting).

As this obviously is a bug in wxWidgets, I think an additional check would be appropriate before CodeLite lets it write the file.

Thank you,
Fred
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Bug report: Editor saves empty source code files

Post by DavidGH »

Hi Fred,

When Eran suggested a bug-report, he meant to the sourceforge bug-tracker; not here, where it will get buried and forgotten ;) .

Regards,

David
Fred
CodeLite Enthusiast
Posts: 43
Joined: Mon Jul 02, 2012 12:53 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Bug report: Editor saves empty source code files

Post by Fred »

Thank you for the hint, David.
It is Bug #833 now.
Regards,
Fred
Post Reply