Pelles C forum

Pelles C => Bug reports => Topic started by: czerny on May 09, 2012, 03:06:02 PM

Title: ansi oem
Post by: czerny on May 09, 2012, 03:06:02 PM
Don't know if this is a bug or what?

If I have a source file for a console projekt and change

file > properties > encoding

from ansi to oem, the file can not be saved anymore. MessageBox('Error writing to file 'tst.c'. Invalid or unknown file format.)
Title: Re: ansi oem
Post by: iZzz32 on May 09, 2012, 03:34:15 PM
Furthermore it will delete the file from disk and you will lose your code if you close IDE without saving.
Title: Re: ansi oem
Post by: czerny on May 09, 2012, 04:50:49 PM
Quote from: iZzz32 on May 09, 2012, 03:34:15 PM
Furthermore it will delete the file from disk and you will lose your code if you close IDE without saving.

That is true!  :(
Title: Re: ansi oem
Post by: Pelle on May 15, 2012, 04:34:26 PM
The OEM encoding should really be dropped soon, since pretty much everything these days are Unicode, but I will look at it...
Title: Re: ansi oem
Post by: CommonTater on May 15, 2012, 05:10:23 PM
Quote from: Pelle on May 15, 2012, 04:34:26 PM
The OEM encoding should really be dropped soon, since pretty much everything these days are Unicode, but I will look at it...

Hi Pelle... 
If you did drop OEM and/or ANSI... what would be the default replacement?  (utf8?)

I ask so that I can begin now, creating projects that will fall into the new scheme.
Title: Re: ansi oem
Post by: Pelle on May 15, 2012, 05:38:24 PM
Hopefully OEM soon, but I doubt it's possible to drop ANSI any time soon. UTF-8 seems pretty popular in general, but UTF-16 may be more popular under Windows.
However, moving to Unicode (and thinking Unicode) in general should be more important than the actual file format I think...
Title: Re: ansi oem
Post by: CommonTater on May 15, 2012, 06:19:42 PM
Quote from: Pelle on May 15, 2012, 05:38:24 PM
Hopefully OEM soon, but I doubt it's possible to drop ANSI any time soon. UTF-8 seems pretty popular in general, but UTF-16 may be more popular under Windows.
However, moving to Unicode (and thinking Unicode) in general should be more important than the actual file format I think...

Of course.  I was just hoping for a little leg up, so I could start now to create project and source files that would not require conversion at some point down the road.

While on the topic of unicode... Is it possible to add a compiler flag or #pragma or somesuch that says "Assume string literals are wchar".  I know it's just one character --the L in front of literals-- but you would be absolutely amazed how often I get caught on it... :D





Title: Re: ansi oem
Post by: Pelle on May 15, 2012, 06:56:31 PM
If you later want to compile with another C compiler you will most likely have to do the work anyway, so why not now?
This is just one of several good reasons not to add this. Ever.
Title: Re: ansi oem
Post by: CommonTater on May 15, 2012, 08:07:56 PM
Quote from: Pelle on May 15, 2012, 06:56:31 PM
If you later want to compile with another C compiler you will most likely have to do the work anyway, so why not now?
This is just one of several good reasons not to add this. Ever.

Ok... point taken.  Thank you.
Title: Re: ansi oem
Post by: Stefan Pendl on May 15, 2012, 09:03:35 PM
How about applications with mixed strings?

Using the L-prefix is the only way to separate each other.