Author Topic: shared source file codepage trouble  (Read 4829 times)

jimmyo

  • Guest
shared source file codepage trouble
« on: August 10, 2007, 10:49:24 am »
Hello,

i use same source file under Windows with Visual Studio
and under Linux with Code::Blocks IDE.

if the sourcefile under windows has some extras char äöü,
CB-IDE convert it to other spcial chars
ö = ö
after compare this file for changes, i always have this changes.
can i change the codepage in CB-IDE, that it does not change this chars ?

Thanks
  Jimmy


Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: shared source file codepage trouble
« Reply #1 on: August 10, 2007, 11:42:12 am »
Hi !

You have to play with default encoding on the Settings\Editor...

Dje

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: shared source file codepage trouble
« Reply #2 on: August 10, 2007, 11:51:43 am »
If the file has UTF-8 encoding, C::B can deal with it. Otherwise if the file has an encoding UTF-16 or above, C::B may not be able to handle it.
« Last Edit: August 10, 2007, 11:53:59 am by Biplab »
Be a part of the solution, not a part of the problem.

Offline rjmyst3

  • Multiple posting newcomer
  • *
  • Posts: 117
    • wxFormBuilder
Re: shared source file codepage trouble
« Reply #3 on: August 10, 2007, 01:25:01 pm »
Visual Studio cannot handle UTF-8 until version 8 (2005).
Even then, the complier will not recognize it as UTF-8 without a BOM.

gcc expects files in UTF-8, unless instructed otherwise. But if the files have a BOM, gcc will not compile them.

I have no suggestion, just pointing out some potential problems.  :(

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: shared source file codepage trouble
« Reply #4 on: August 10, 2007, 02:11:55 pm »
Hi Biplab !

If the file has UTF-8 encoding, C::B can deal with it. Otherwise if the file has an encoding UTF-16 or above, C::B may not be able to handle it.

Why are all these encoding available if not supported in Code::Blocks ?
What happens if they are used (I suppose they are proposed because Scintilla supports them) ?

Dje

jimmyo

  • Guest
Re: shared source file codepage trouble
« Reply #5 on: August 10, 2007, 03:12:37 pm »
Hi all,

Thanks for help,
Change in the Editor Settings to WINDOWS 1252, and it work.

Thanks all,
  Jimmy

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: shared source file codepage trouble
« Reply #6 on: August 10, 2007, 04:02:14 pm »
Why are all these encoding available if not supported in Code::Blocks ?
What happens if they are used (I suppose they are proposed because Scintilla supports them) ?

The code to handle encoding is there. But, I guess, it was disabled long back due to some nasty crash. :)

I had the same doubt like you and I started playing with the code to enable these options. So far I've found the following.
  • The disabled code can detect and handle files with upto UTF-16.
  • But it works well if you move upwards. I mean if you move from UTF-8 to higher. Your file will become a garbage if you move downwards, i.e., UTF-32 to UTF-8.
  • Presently UTF-16BE puts C::B into an infinite loop.
  • The encoding handling code, file loading code needs a lot of improvements.

As you can understand, this is a vital code for C::B. Thus I'm still trying to figure out an optimal solution which I can put forward for further testing. :)

For the time being, please don't use C::B with an encoding beyond UTF-8.
Be a part of the solution, not a part of the problem.

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: shared source file codepage trouble
« Reply #7 on: August 10, 2007, 04:05:04 pm »
Thanks for these precise info Biplab

Dje