Page 1 of 1

Bug report: Editor saves empty source code files

Posted: Sun Oct 21, 2012 11:32 am
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

Re: Bug report: Editor saves empty source code files

Posted: Sun Oct 21, 2012 1:00 pm
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

Re: Bug report: Editor saves empty source code files

Posted: Mon Oct 22, 2012 8:43 am
by Fred
Thank you for the hint, David.
It is Bug #833 now.
Regards,
Fred