Code::Blocks

User forums => Help => Topic started by: coditoter on July 19, 2014, 11:05:27 am

Title: Is it possible to add a new codepage?
Post by: coditoter on July 19, 2014, 11:05:27 am
Hello geeks!
I'm writing in help because I think that the problem should be there but it can be also put in new feature or sth like that subforum.
Well, the problem is quite simply. Windows console uses code page 852 or (it is also named OEM 852). You can not care it if you're an Englishman but ... I'm in Poland and if i use my special characters like "ąęźć..." I see strange characters. So, I must use also that code page  in C::B editor. Unfortunately, nowadays it's not supported. Is it possible to add that code page do C::B editor because I don't want to use Notepad++ to change code page, then compile, edit file, then change... you know. I cross compile to windows using linux but the problem also exists on windows.
Really thanks for answer. I think that the solution should be quite easy ;).
Title: Re: Is it possible to add a new codepage?
Post by: BlueHazzard on July 19, 2014, 01:47:54 pm
use utf8....
http://forums.codeblocks.org/index.php/topic,18803.msg128791.html#msg128791
Title: Re: Is it possible to add a new codepage?
Post by: coditoter on July 19, 2014, 02:23:49 pm
But that's nonsense. Why have I to use UTF-8, avoid cin & cout, change too many things ... if the best solution is to change code page?
That solution works perfectly and I only want to use new code page (Windows default) - OEM 852 in C::B. Is it REALLY hard to add it?
Title: Re: Is it possible to add a new codepage?
Post by: stahta01 on July 19, 2014, 02:40:51 pm
Quote
Windows console uses code page 852 or (it is also named OEM 852)

Install scintilla is the codepage supported? If not, it is unlikely CB will support it.

http://sourceforge.net/projects/wxscintilla/ (http://sourceforge.net/projects/wxscintilla/)

The CB editor is a modified version of a wxscintilla.

Tim S.
Title: Re: Is it possible to add a new codepage?
Post by: stahta01 on July 19, 2014, 03:46:12 pm
The only related source file(s) that I found was editorconfigurationdlg.cpp and editor_configuration.xrc.

Note, backup the the file before trying to edit; note: CB must be closed while editing.
Editing the conf files is NOT recommended as a safe way to do changes.
The list appears to NOT be in the CB source file; so, I am guessing it is Operating System supplied.

I am NOT a CB Developer; this is NOT a safe thing to do (Edit the conf file).

Found in Windows CB default.conf file.
Code: [Select]
<DEFAULT_ENCODING>
<str>
<![CDATA[WINDOWS-1252]]>
</str>
</DEFAULT_ENCODING>

Tim S.
Title: Re: Is it possible to add a new codepage?
Post by: stahta01 on July 19, 2014, 03:53:18 pm
I think I found the source of the list "wxFontEncoding".

I suggest building "wxWidgets/samples/font" is the font listed in the sample?
If not, it is likely an issue on your PC or in wxWidgets.

Edit2: I would guess it is a wxWidgets lack of support issue. But, I can not test it since I do NOT have that font on my PC.

Edit3: I would guess the lack of being listed in wxWidgets's common/fmapbase.cpp file is the likely cause of CB not listing it.

Tim S.
Title: Re: Is it possible to add a new codepage?
Post by: jens on July 19, 2014, 04:21:12 pm
The only related source file(s) that I found was editorconfigurationdlg.cpp and editor_configuration.xrc.

Note, backup the the file before trying to edit; note: CB must be closed while editing.
Editing the conf files is NOT recommended as a safe way to do changes.
The list appears to NOT be in the CB source file; so, I am guessing it is Operating System supplied.

I am NOT a CB Developer; this is NOT a safe thing to do (Edit the conf file).

Found in Windows CB default.conf file.
Code: [Select]
<DEFAULT_ENCODING>
<str>
<![CDATA[WINDOWS-1252]]>
</str>
</DEFAULT_ENCODING>

Tim S.

It's a wxWidgets list, if I recall correctly, so changing the conf-file will not work and probably lead to crashes.
What about iso8859-2  (latin-2) ?
Title: Re: Is it possible to add a new codepage?
Post by: coditoter on July 19, 2014, 06:14:45 pm
I tried iso8859-2 but it's not working correctly... generally, it's nosense to use other code page that OEM 852 because MS Console uses it (and wine implementation too probably). So it would be great upgrade 4 Win coders to use Win console code page :D.
Title: Re: Is it possible to add a new codepage?
Post by: stahta01 on July 19, 2014, 06:16:54 pm
I tried iso8859-2 but it's not working correctly... generally, it's nosense to use other code page that OEM 852 because MS Console uses it (and wine implementation too probably). So it would be great upgrade 4 Win coders to use Win console code page :D.

I gave you enough info; now do some work or shut-up!

Tim S.
Title: Re: Is it possible to add a new codepage?
Post by: BlueHazzard on July 19, 2014, 09:30:50 pm
I tried iso8859-2 but it's not working correctly... generally, it's nosense to use other code page that OEM 852 because MS Console uses it (and wine implementation too probably). So it would be great upgrade 4 Win coders to use Win console code page :D.

I gave you enough info; now do some work or shut-up!

Tim S.

don't be this rude... jens mentioned that this is a wxWidgets issue and can't be changed that easy...

@oditoter
There are many good reasons to NOT use the win default code page
And there are twice as much reasons to use utf8  (the windows console is a relict from win16 time, and windows should be forced to implement a new console with utf8...) you can read here some statements: http://utf8everywhere.org/

But that's nonsense. Why have I to use UTF-8, avoid cin & cout, change too many things ...
The nonsense here lays on Microsoft site... If you want code platform independent (as you mentioned earlier) then the easiest way is my approach, and then you have really Unicode support, and not this pseudo implementation from Microsoft... not use cin and cout are the lowest problem you will heave...

BUT if you find some way to set a new codepacge or any other way to successfully use unicode in the windows console, i would really be happy if you can post your solution here!!!!

greetings
Title: Re: Is it possible to add a new codepage?
Post by: stahta01 on July 19, 2014, 09:43:16 pm
I tried iso8859-2 but it's not working correctly... generally, it's nosense to use other code page that OEM 852 because MS Console uses it (and wine implementation too probably). So it would be great upgrade 4 Win coders to use Win console code page :D.

I gave you enough info; now do some work or shut-up!

Tim S.

don't be this rude... jens mentioned that this is a wxWidgets issue and can't be changed that easy...

@oditoter
There are many good reasons to NOT use the win default code page
And there are twice as much reasons to use utf8  (the windows console is a relict from win16 time, and windows should be forced to implement a new console with utf8...) you can read here some statements: http://utf8everywhere.org/

But that's nonsense. Why have I to use UTF-8, avoid cin & cout, change too many things ...
The nonsense here lays on Microsoft site... If you want code platform independent (as you mentioned earlier) then the easiest way is my approach, and then you have really Unicode support, and not this pseudo implementation from Microsoft... not use cin and cout are the lowest problem you will heave...

BUT if you find some way to set a new codepacge or any other way to successfully use unicode in the windows console, i would really be happy if you can post your solution here!!!!

greetings

Did he try to compile the wxWidgets sample I posted before Jen posted!!!!

You are the rude person who has NOT read this thread!!

Tim S.
Title: Re: Is it possible to add a new codepage?
Post by: coditoter on July 20, 2014, 11:00:33 am
@stahta01
Sorry but the only rude person there is(are) ... you. You suggested changing conf files but It was a complete nosense. If the code page had been included in C::B it would be easy to change it there but it isn't (the same problem on Windows...). So I just ignored your opinion (I remind you that you said 'I'm not a C::B dev) waiting for someone who knows more. And jens confirmed what I thought.
@BlueHazzard
Could you help me to make code changing font to Lucida Console in my program (to console...)? I'm quite newbie in programming (you see... still in console) and I guess that it is included in windows.h . I tried on my own using prepared code but I failed.
Maybe it'd be nice workaround by the time I start coding windows apps ;)
Title: Re: Is it possible to add a new codepage?
Post by: stahta01 on July 20, 2014, 01:14:14 pm
@stahta01
Sorry but the only rude person there is(are) ... you. You suggested changing conf files but It was a complete nosense. If the code page had been included in C::B it would be easy to change it there but it isn't (the same problem on Windows...). So I just ignored your opinion (I remind you that you said 'I'm not a C::B dev) waiting for someone who knows more. And jens confirmed what I thought.
@BlueHazzard
Could you help me to make code changing font to Lucida Console in my program (to console...)? I'm quite newbie in programming (you see... still in console) and I guess that it is included in windows.h . I tried on my own using prepared code but I failed.
Maybe it'd be nice workaround by the time I start coding windows apps ;)

Are you all incapable of reading!!!

Lazy idiots and ignorant users; not willing to build a single wxWidgets sample are NOT worth my time!!!

Tim S.
Title: Re: Is it possible to add a new codepage?
Post by: jens on July 20, 2014, 01:23:19 pm
@stahta01
Sorry but the only rude person there is(are) ... you. You suggested changing conf files but It was a complete nosense. If the code page had been included in C::B it would be easy to change it there but it isn't (the same problem on Windows...). So I just ignored your opinion (I remind you that you said 'I'm not a C::B dev) waiting for someone who knows more. And jens confirmed what I thought.
@BlueHazzard
Could you help me to make code changing font to Lucida Console in my program (to console...)? I'm quite newbie in programming (you see... still in console) and I guess that it is included in windows.h . I tried on my own using prepared code but I failed.
Maybe it'd be nice workaround by the time I start coding windows apps ;)

Are you all incapable of reading!!!

Lazy idiots; not willing to build a single wxWidgets sample are NOT worth my time!!!

Tim S.

Please calm down.
There's no need to get aggressive or offending.
Title: Re: Is it possible to add a new codepage?
Post by: stahta01 on July 20, 2014, 01:33:13 pm
I am finished helping this site for a while; I get insulted for posting the rules to ignorant users!!

It is just NOT worth the hassle trying to help the new posters on this site; they are just too ignorant of the rules of this site.

And they are just too ignorant of programming.

And, they seem unable to read and understand my replies.

I wasted over an hour trying to help the OP and they appears to NOT even have read my posts.

Tim S.
Title: Re: Is it possible to add a new codepage?
Post by: stahta01 on July 20, 2014, 01:34:25 pm
I think I found the source of the list "wxFontEncoding".

I suggest building "wxWidgets/samples/font" is the font listed in the sample?
If not, it is likely an issue on your PC or in wxWidgets.

Edit2: I would guess it is a wxWidgets lack of support issue. But, I can not test it since I do NOT have that font on my PC.

Edit3: I would guess the lack of being listed in wxWidgets's common/fmapbase.cpp file is the likely cause of CB not listing it.

Tim S.


Did no one ever read this post!!

Tim S.
Title: Re: Is it possible to add a new codepage?
Post by: BlueHazzard on July 20, 2014, 11:16:14 pm
Could you help me to make code changing font to Lucida Console in my program (to console...)? I'm quite newbie in programming (you see... still in console) and I guess that it is included in windows.h . I tried on my own using prepared code but I failed.
Maybe it'd be nice workaround by the time I start coding windows apps ;)

(at least what i know, but i'm not a good windows programmer) you can change the fond only from the settings of the cmd window....

I think I found the source of the list "wxFontEncoding".

I suggest building "wxWidgets/samples/font" is the font listed in the sample?
If not, it is likely an issue on your PC or in wxWidgets.

Edit2: I would guess it is a wxWidgets lack of support issue. But, I can not test it since I do NOT have that font on my PC.

Edit3: I would guess the lack of being listed in wxWidgets's common/fmapbase.cpp file is the likely cause of CB not listing it.

Tim S.


Did no one ever read this post!!

Tim S.

1) i didn't saw the edits, sorry
2) font != codepage, and so i got confused
3) i don't think that anyone wanted to harass you, but sometimes your way how you write your answers seems rude, so no offense

greetings
Title: Re: Is it possible to add a new codepage?
Post by: coditoter on July 21, 2014, 06:22:42 pm
I am finished helping this site for a while; I get insulted for posting the rules to ignorant users!!

It is just NOT worth the hassle trying to help the new posters on this site; they are just too ignorant of the rules of this site.

And they are just too ignorant of programming.

And, they seem unable to read and understand my replies.

I wasted over an hour trying to help the OP and they appears to NOT even have read my posts.

Tim S.
Yes, I agree with that one statement. Sometimes it's really hard to understand what you mean. We're talking about encoding and you ... about fonts. What?! I totally got lost with your solutions.

So I write some facts:
1)the problem's strongly connected with codeblocks - NOT my system, installed fonts and so on. I found a workaround (see below) and there everything works OK with encoding.
2)You suggested a solution on windows ... but I use linux. Despite that, I looked and found finally config file on linux. Linux uses UTF-8(the file confirmed it), console also so there're no problem with encoding there - console and editor use the same encoding. I think that problem with encoding on win  can be connected with that ... that the editor C::B doesn't have OEM 852 encoding included. Simply. So I think that the best way'd be just to ... add it?. Or change editor. Or change encoding in old-fashioned win console. I think that the best 'd be to add encoding - really helpful4all PL users.
3)I really don't know how to add that encoding in C::B.So I wrote there as a last sort. I'm really not a lazy user  - I tried so many solutions that finally I got eggy and write there. I'm also still investigating the case ;)
4)I also don't sit all day looking in C::B files. And if you mean "wxWidgets/samples/font" I really don't know what you mean - C::B source? C::B folder? Or what? What to build? And why fonts?
5)You're still talking about users that ignore that site's regulamin. But I don't know how did you write some many answers because you behave seriously rude. I read your answer, try TO UNDERSTAND it but ... you're still talking about laziness, my ignorance, stupidness and so on... I 've used many forums and so rude users usually ended up becoming warn. I REALLY TRY TO solve the problem, I don't do nothing. But on the other hand, how I write before, I don't use C::B 24 hours / 7 day editing everything what I can. I don't build it and so on. I don't know what you mean by "C::B sample font(??!). I JUST USE it as my IDE to compile sth else. And by the way - my machine is quite old so if I want to search all my HDD it takes AGES. If you want to help please give more info and if you can - more clearly.
____

So the workaround is to use ... Visual Studio Express to create Win console projects with correct enoding. Why? Because MS included MORE code pages to use. For example mentioned before OEM 852 to encode my national chars like "ąąęęęććć". But it is only for non-commercial usage (if you don't want to pay) and non-free (also ofc not working on linux) so it's not perfect. And what's more, I think that VS 2010's really problem with auto-completion, in contrast to C:: B :) . So if anyone find better solution, please tell. And give "more full" directory to the files if you find sth.

What to do? Create a file and before saving choose in "file" menu option "advanced save" or sth like that and choose correct encoding. That's all.