Author Topic: Request feature: Win only, OEM  (Read 10585 times)

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Request feature: Win only, OEM
« on: November 01, 2005, 01:46:33 pm »
I have few the big projects. They started in OS/2 and migrate to Win and Linux now.
Sources use OEM charset. For use other charsets used decoders (for ex. OEM to Win).
Now I use Terminal fonts for normal view sources, but I have troubles with keyboard input.


Add to Editor Property: OEM Yes/No.
This parameter use on open and save files for win version only.
On Open and Save file - decode it.
For decode use Win API functions CharToOEM*, OEMToChar*.
Unicode supported (for ex. CharToOEMW exist).


Problem may be one more wide, than look.

Thanks.

PS I would look a cdeditor sources for patch it.

OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Request feature: Win only, OEM
« Reply #1 on: November 01, 2005, 02:59:20 pm »
Hmm, I have to admit that I don't understand what exactly you're talking about, because I have no idea what "OEM charset" is supposed to be.

Anyway, lets just say you have your sources in some strange, evil charset.

1. Do you think it will help if the editor alone understands your charset? If you don't translate them alltogether, the compiler will not be able to read your sources either, so it will be pretty useless.
2. Have you tried gnu recode? I have no clue about "OEM", but recode reads and writes just about everything that exists.
3. Have you considered writing a plugin that reads in all files from a project, runs the text through OEMToChar, and saves the text again? This would be a lot easier and more straightforward than modifying the editor and would solve the problem with the compiler, too.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Request feature: Win only, OEM
« Reply #2 on: November 01, 2005, 04:12:22 pm »
Hello,

OEM charset (Original Equipment Manufacturer) are "the 8th bit often contained characters for line drawings as a carry over from pre-GUI (Graphics User Interface) days. Used by DOS, OS/2, floppy disks, and the FAT system (File Allocation System)". Some info can be found here:

http://www.georgehernandez.com/h/xComputers/CharacterSets/Index.htm

May be this small program could be of some help for you:

http://icc.dk/freeware/ansikonv.htm

If GNU recode would not be helpful, Thomas's suggestion to write a plugin is a good alternative. A plugin that read OEM files and convert them to Char by using the OemToChar function (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/strings/stringreference/stringfunctions/oemtochar.asp).

Best wishes,
Michael

PS.: Anyway, interesting tool recode. I did not know it.

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: Request feature: Win only, OEM
« Reply #3 on: November 01, 2005, 04:22:58 pm »
Hmm, I have to admit that I don't understand what exactly you're talking about, because I have no idea what "OEM charset" is supposed to be.

Anyway, lets just say you have your sources in some strange, evil charset.

OEM charset - DOS charset (codepages for ex. 437, 866 and some other).

Quote
1. Do you think it will help if the editor alone understands your charset? If you don't translate them alltogether, the compiler will not be able to read your sources either, so it will be pretty useless.

OEM affect for charcodes > 0x7F (literal strings only). No problem for compiler. For example, I have russian messages into program.
Look this: printf( "Ïðèìåð ðóññêîãî òåêñòà\n" );
Translated text: "Example of russian text\n"

Quote
2. Have you tried gnu recode? I have no clue about "OEM", but recode reads and writes just about everything that exists.
3. Have you considered writing a plugin that reads in all files from a project, runs the text through OEMToChar, and saves the text again? This would be a lot easier and more straightforward than modifying the editor and would solve the problem with the compiler, too.

No problem recode all source files to Win charset, for ex. But I can't use this way now. May be later.

I taste MED (http://www.med-editor.com), this program can use an OEM charset without problem.
If it hardly in C::B, I would search another way.

Thanks you for suggestions.

OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Request feature: Win only, OEM
« Reply #4 on: November 01, 2005, 05:58:35 pm »
Try this. No guarantees, whacked that together in ~10 minutes, but it should do.


[attachment deleted by admin]
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: Request feature: Win only, OEM
« Reply #5 on: November 02, 2005, 08:41:22 am »
Try this. No guarantees, whacked that together in ~10 minutes, but it should do.

Thanks for sources.
This way can't help. It's "one way ticket". On save file was corrupted. But it not main.
As I say early, really this work necessary make on open and save file (cbEditor::Open and cbEditor::Save).
And switch up it in editor properties.

I take an advatage of your method for temporary, may be.

I would have hear C::B developers suggestions.
If not, I solve this problem myself.

OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Request feature: Win only, OEM
« Reply #6 on: November 02, 2005, 10:36:25 am »
This way can't help. It's "one way ticket".

Actually it is not one way. Just add another menu item "Char to OEM" and call the other function. This is 5 lines of code added.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: Request feature: Win only, OEM
« Reply #7 on: November 02, 2005, 11:49:57 am »
This way can't help. It's "one way ticket".

Actually it is not one way. Just add another menu item "Char to OEM" and call the other function. This is 5 lines of code added.

You right, absolutely! Sorry, for my familiarity.

I solve my problem globally. I add An Editor Propery "Use OEM Charset" (see screenshot, checkbox: chkOEMCharset == "/editor/use_oem_charset").
Now on load file (cbEditor::Open) and on save file (cbEditor::Save) text recoded if this checkbox checked. It's work.
Last change now - recode opened files on change Editor Property "Use OEM Charset", and testing.
I ready to publish patch after testing if anybody need it.

Good luck!


[attachment deleted by admin]
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Request feature: Win only, OEM
« Reply #8 on: November 02, 2005, 12:56:10 pm »
Actually, I just found out that wxScintilla supports OEM natively. Don't know how to configure the charset (yet), but wxscintilla.h contains this:
Code
#define wxSCI_CHARSET_OEM 255

So it must be possible (and probably relatively easy, too) to edit whatever charset natively without converting anything.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: Request feature: Win only, OEM
« Reply #9 on: November 02, 2005, 01:07:54 pm »
Actually, I just found out that wxScintilla supports OEM natively. Don't know how to configure the charset (yet), but wxscintilla.h contains this:
Code
#define wxSCI_CHARSET_OEM 255

So it must be possible (and probably relatively easy, too) to edit whatever charset natively without converting anything.

Yes, I see it. But wxScintilla::SetCodePage() not support this (docs sound it).
wxScintilla::SetStyle.. may be use, but docs - very bit small, and "time is money", I have many work now.
I try use it for a first time, but have noting result. May be later, then I found some times, I see this way again.

Thanks you for advice.
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Request feature: Win only, OEM
« Reply #10 on: November 02, 2005, 01:15:24 pm »
I am waiting for the compile to finish atm, trying StyleSetCharacterSet . Though I don't know how it works... but will hopefully find out. This may be interesting not only for you but for a few other people, too. If StyleSetCharacterSet works out, it should be a no-timer to add a wxChoice for all available charsets.

Do you mind posting one of your OEM encoded files so I can see the result?
« Last Edit: November 02, 2005, 01:18:06 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: Request feature: Win only, OEM
« Reply #11 on: November 02, 2005, 01:45:07 pm »
I am waiting for the compile to finish atm, trying StyleSetCharacterSet . Though I don't know how it works... but will hopefully find out. This may be Do you mind posting one of your OEM encoded files so I can see the result?

I attach a simple text file. A first line - is russian text (codepage 866), second - english text.
After recode, a first line must look difference, a second - no changed.

I can test you patch, then I have CVS version C::B.

I wait  :roll:
:)


[attachment deleted by admin]
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Request feature: Win only, OEM
« Reply #12 on: November 02, 2005, 02:26:42 pm »
Hmm... seems I am doing something wrong, StyleSetCharacterSet does not change anything, even if I call it for every style in a for loop. Will have to find some documentation and read, maybe that helps ;)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline kisoft

  • Almost regular
  • **
  • Posts: 194
Re: Request feature: Win only, OEM
« Reply #13 on: November 02, 2005, 02:46:03 pm »
Hmm... seems I am doing something wrong, StyleSetCharacterSet does not change anything, even if I call it for every style in a for loop. Will have to find some documentation and read, maybe that helps ;)

Really help!
I investigate sources, they more look see then docs   :|

IMHO, StyleSetCharacterSet - change Font Charset only, this way don't help me.

I continue testing my way, clipboard Copy/Paste work true. Open/Save too.
Some more changes required on change OEM checkbox into Editor Properties if I have a some opened files.
A checkbox required watch on change, and after change in cbEditor::SetEditorStyle recode text buffer.
May be it required add flag to cbEditor class.
OS: WinXPSP3
wxWidgets: 2.8.12
CodeBlocks: Master github cbMakefileGen plugin:
https://github.com/kisoft/cbmakefilegen