Special character in Borland c++ Builder

3k views Asked by At

I just wanna use Delta sign "Δ" in Borland c++ Builder 5.

for example in a label:

Label1->Caption = "delta sign here?";

thnx.

2

There are 2 answers

0
Remy Lebeau On

C++Builder 5 uses an ANSI-based VCL and ANSI-based Win32 API calls, where the ANSI encoding is dictated by the active user's locale settings in Windows.

If your app is running on a Greek machine that uses Latin-7/ISO-8859-7 (Windows codepage 28597) as its native locale, or at least has Greek fonts installed, you should be able to set the Label1->Font->Charset to GREEK_CHARSET (161) and Label1->Font->Name to a Greek font, and then assign the Delta character like this:

// using an implicit conversion from Unicode
// to ANSI on a Greek-locale machine...
Label1->Caption = L"Δ";
Label1->Caption = L"\x0394";
Label1->Caption = (wchar_t) 0x0394;
Label1->Caption = (wchar_t) 916;

Or:

// using an explicit Greek ANSI codeunit
// on a Greek font machine...
Label1->Caption = (char) 0xC4;
Label1->Caption = (char) 196;

However, if you need to display the Delta character on a non-Greek machine, or at least one that does not have any Greek fonts installed, you will have to use a third-party Unicode-enabled Label component, such as from the old TNTWare component suite, so that you can use Unicode codepoint U+0394 directly, eg:

TntLabel1->Caption = L"Δ";
TntLabel1->Caption = L"\x0394";
TntLabel1->Caption = (wchar_t) 0x0394;
TntLabel1->Caption = (wchar_t) 916;
5
webo80 On

If you are on Windows:

EDIT: Try ALT + 30, it works! ▲▲▲▲