Author Topic: getting lots of stray errors due to file encoding incompatibility  (Read 4624 times)

Offline ausairman

  • Multiple posting newcomer
  • *
  • Posts: 12
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?
Ubuntu 11.04 (64-bit), optiplex 990 i7

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: getting lots of stray errors due to file encoding incompatibility
« Reply #1 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)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: getting lots of stray errors due to file encoding incompatibility
« Reply #2 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.

Offline ausairman

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: getting lots of stray errors due to file encoding incompatibility
« Reply #3 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!
Ubuntu 11.04 (64-bit), optiplex 990 i7