Code::Blocks Forums

User forums => Help => Topic started by: ausairman on July 05, 2011, 09:57:37 am

Title: getting lots of stray errors due to file encoding incompatibility
Post by: ausairman on July 05, 2011, 09:57:37 am
Hi everyone,
I use codeblocks on both ubuntu and windows, and have been writing most of my code in ubuntu lately. However, now when I try to run my programs I get a bunch of "error: stray '/###' in program" where ### is usually 239, 187 or 191. I have looked over my files in notepad but can't see any of the usual suspects (’ instead of ', etc.). Besides it runs fine on ubuntu. I am guessing this means that it's a file encoding problem right? Is there some easy fix for this, like converting them to a format that both windows and ubuntu use? If so, how does one go about doing that?
Title: Re: getting lots of stray errors due to file encoding incompatibility
Post by: oBFusCATed on July 05, 2011, 01:29:41 pm
1. Don't use anything outside of the ASCII set, else you'll have problems
2.1. You can use power-editor of your choice to do the conversion (utraedit, probably scite, ...)
2.2. You can install and use iconv to convert the characters
3. You can edit the characters inside C::B
4. Probably you could play with Edit->File encoding to see if it fixes the problem (I guess not)
Title: Re: getting lots of stray errors due to file encoding incompatibility
Post by: Jenna on July 05, 2011, 02:06:06 pm
If the file is saved as unicode and not utf-8 it might not be usable on windows.
If it is utf-8, make sure it is not saved with the byte-order-mark (BOM). You can change encoding via "Edit-> File encoding" and save it afterwards.
Title: Re: getting lots of stray errors due to file encoding incompatibility
Post by: ausairman on July 06, 2011, 05:24:14 am
If the file is saved as unicode and not utf-8 it might not be usable on windows.
If it is utf-8, make sure it is not saved with the byte-order-mark (BOM). You can change encoding via "Edit-> File encoding" and save it afterwards.

I converted the offending files to UTF-8 (Without BOM), and this fixed the problem. The files were all in UTF-8 - presumably with BOM. If I problems with these files in Ubuntu now I'll post back!