1. National characters under Borland C++ 5.02 Windows/DOS

Dear Euphorians:
Of course this is an Off-topic question.
I am having problems with Borland C++ 5.02 because, when you specify a
character string in the editor, using national characters (in Spanish
áéíóúüñ etc.), it uses the Windows standard for them. However, when you
compile and execute such a program by means of the facilities that come with
the compiler (for example, the "lightning" button), it executes the program
under a DOS windows, and the national characters show as strange graphs.
Does someone know a way to avoid this problem?
TIA.

new topic     » topic index » view message » categorize

2. Re: National characters under Borland C++ 5.02 Windows/DOS

DOS and Windows use different code pages. I guess your editor is for Windows,
so it uses ANSI code page for Spanish, while DOS box uses OEM code page.
You need to convert between this two. (Eg. EditPad has OEM<->ANSI function,
also Windows API has some OEM<->ANSI functions) Also be sure to have DOS
codepage selected correctly, using lines

mode con codepage prepare=((852) C:\WINDOWS\COMMAND\ega.cpi)
mode con codepage select=852

in autoexec.bat (you need to replace 852 with codepage number for
Spanish)

If none of this helps, ask Igor smile

    Martin

----- Original Message -----
From: <rforno at tutopia.com>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, August 04, 2002 7:19 AM
Subject: National characters under Borland C++ 5.02 Windows/DOS

Dear Euphorians:
Of course this is an Off-topic question.
I am having problems with Borland C++ 5.02 because, when you specify a
character string in the editor, using national characters (in Spanish
áéíóúüñ etc.), it uses the Windows standard for them. However, when you
compile and execute such a program by means of the facilities that come with
the compiler (for example, the "lightning" button), it executes the program
under a DOS windows, and the national characters show as strange graphs.
Does someone know a way to avoid this problem?
TIA.

new topic     » goto parent     » topic index » view message » categorize

3. Re: National characters under Borland C++ 5.02 Windows/DOS

Hello Ricardo,

----------
> Îò: rforno at tutopia.com
> Êîìó: EUforum <EUforum at topica.com>
> Òåìà: National characters under Borland C++ 5.02 Windows/DOS
> Äàòà: 4 àâãóñòà 2002 ã. 9:19
> 
> Dear Euphorians:
> Of course this is an Off-topic question.
> I am having problems with Borland C++ 5.02 because, 
> when you specify a character string in the editor, 
> using national characters (in Spanish áéíóúüñ etc.),
> it uses the Windows standard for them. However, when 
> you compile and execute such a program by means of 
> the facilities that come with the compiler 
> (for example, the "lightning" button), it executes 
> the program under a DOS windows, and the national 
> characters show as strange graphs.
> Does someone know a way to avoid this problem?
> TIA.

This problem exists because of MS DOS and MS Windows
have different code pages (CPs). 
If you are working on plain DOS, in the DOS window 
or on Windows console, these code pages 
are 8??, so Windows uses *the fonts* for these CPs,
OEM encoding, terminal font.

Your *strings* are *stable* but depend on editor
you use. ed - DOS encoding, 
NotePad - Windows (ANSI) encoding,
there are editors where you can switch fonts - 
Jfe and CodeGenie, for example. 
Use Terminal font in these editors and you'll 
have DOS encoding for strings.
Or you can copy/paste strings from the 
NotePad's txt files into your program under ed.
You'll see some strange characters in ed, but 
the *pure* Windows program will output the right
strings. But on consoles - other thing.

Compiler do nothing with you strings encoding.

Just Windows changes the fonts.

There is one exception with ex.exe interpreter.
In the *text* modes it uses system DOS fonts,
but in *graphics* modes it uses the inner 
hardly built in fonts.

Try please (for more examples about DOS
encodings) package:

http://www.rapideuphoria.com/nuphor23.zip

to get the light (compiled source) PD ex.exe 
with another built in fonts.
That nuphor23.zip is Rob's and my co-work.
The interpreters of nuphor23.zip allow
any national or special characters (128..255)
for identifiers in the Euphoria programs.

Or try please my Polyglot package:

http://www.rapideuphoria.com/polyglot.zip

This program can to work with Chinese, Japanese 
and Korean now (with many other langs too ;).

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

4. Re: National characters under Borland C++ 5.02 Windows/DOS

Ricardo Forno wrote:
> Thanks, Igor, but the problem is how to use the standard facilities of
> Borland C++ 5.02 without too much fuss. Please see my answer to Martin
> Stachon.

I can't see any answer to my message...Topica?!

I have never seen your Borland IDE, but maybe you can set up codepage for
editing?
Or perhaps you can write a simple tool to run your code thru and change code
page.
(Maybe you could also tell the IDE to do it automatically during build process)
btw you can use windows API function for this:

/* Win->Dos */
BOOL CharToOem(

    LPCTSTR lpszSrc, // pointer to string to translate  
    LPSTR lpszDst  // pointer to translated string 
   );


/* Dos->Win
BOOL OemToChar(

    LPCSTR lpszSrc, // pointer to string to translate 
    LPTSTR lpszDst  // pointer to buffer for translated string  
   );

or you can just use your own table for conversion.

Or perhaps you can write a macro in C to let the preprocessor do this
for you? I am not a skilled C programmer, but I don't know how to change
strings with macro. (But still possible in runtime)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu