Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Greek Strings in non unicode app
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Greek Strings in non unicode app

 Post Reply Post Reply
Author
Message
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Topic: Greek Strings in non unicode app
    Posted: 24 January 2020 at 4:40am
I tried to localize my ribbon and tabs using as a guide an older answer from Oleg.

You can add toolkit resources to same dll - add
#include "XTToolkitPro.rc"

and can define before
#define _XTP_RESOURCE_LANGUAGE el
to include Hebrew version instead English.

and in code add
XTPResourceManager()->SetResourceHandle(hYourDllHandle)

But my application (non unicode) is partially shows greek strings. Take a look. What am I doing wrong?

Just me!
Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 26 January 2020 at 12:29pm
Its seems that using directly an LPCTSTR string in the AddTab method like below, it works perfectly instead of using nID from the string table.

CXTPRibbonTab* pTabHome = pRibbonBar->AddTab(_T("ΕΛΛΗΝΙΚΑ"));

I think that codejock team have to fix this.


Just me!
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 29 January 2020 at 3:27am
Is it an UNICODE application?
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 29 January 2020 at 3:41am
Originally posted by mgampi mgampi wrote:

Is it an UNICODE application?

No, no unicode app.
Just me!
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 29 January 2020 at 5:40am
Which encoding are you using for your .rc files? Perhaps that's the reason.
What do you get when you call CString::LoadString()? Is the content ok or not?
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 29 January 2020 at 5:41am
Ah, and don't forget to check the #pragma codepage in your rc files
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 29 January 2020 at 9:30am
Originally posted by mgampi mgampi wrote:

Which encoding are you using for your .rc files? Perhaps that's the reason.
What do you get when you call CString::LoadString()? Is the content ok or not?

My settings

inside *.rc2

#define _XTP_RESOURCE_LANGUAGE el

inside *.rc

LANGUAGE LANG_GREEK, SUBLANG_DEFAULT
#pragma code_page(1253)

CString::LoadString()
I get gibberish instead of Greeks but String Table is notated as [Greek]
Just me!
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 30 January 2020 at 3:43am
What happens if you try CStringW::LoadString instead of CString::LoadString (which indeed takes CStringA::LoadString())?
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 01 February 2020 at 4:27am
Originally posted by mgampi mgampi wrote:

WHat happens if you try CStringW::LoadString instead of CString::LoadString (which indeed takes CStringA::LoadString())?

Testing with 

CStringW strFormat;
strFormat.LoadString(136);

In this way it works just fine.  

But what this exactly means? That my String Table is saved as a Unicode file and Compiler can not manage this?

Regards,
Just me!
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 01 February 2020 at 11:21am
In Visual Studio IDE you can choose the file encoding when you call "Save as...". Just press the down  arrow of the save button and select the correct encoding according your codepage 1253.

You can use Notepad++ for example to test the current encoding of your file and you can change the encoding if it's wrong using the "Encoding" main menu item of the same editor.

Hope this helps!
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 01 February 2020 at 11:25am
...and another hint:

the correct order of statements in .rc2 file is

#define _XTP_RESOURCE_LANGUAGE el
#include "XTToolkitPro.rc"

First define the required language and the include the .rc file
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 02 February 2020 at 5:13am
Originally posted by mgampi mgampi wrote:

...and another hint:

the correct order of statements in .rc2 file is

#define _XTP_RESOURCE_LANGUAGE el
#include "XTToolkitPro.rc"

First define the required language and the include the .rc file

I already used this order in my projects.
Just me!
Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 02 February 2020 at 5:39am
Originally posted by mgampi mgampi wrote:

In Visual Studio IDE you can choose the file encoding when you call "Save as...". Just press the down  arrow of the save button and select the correct encoding according your codepage 1253.

You can use Notepad++ for example to test the current encoding of your file and you can change the encoding if it's wrong using the "Encoding" main menu item of the same editor.

Hope this helps!

This project is pretty old and I am using VS2008. For *.rc files the option "Save as" is disabled, but it works with all other files.

So, I used Notepad++. I confirm that this is an ANSI file and I choose Greek 1253 as character encoding, before I save the file. Inside the *.rc file I can see without problems the Greek characters as well as inside the Visual Studio String Table. 

No matter what, everytime I open once again the file under Notepad++, it reports ANSI but character encoding is turned back to default which is Greek ISO 8859-7. 

I also changed the *.rc file to 

#ifdef _WIN32
LANGUAGE LANG_GREEK, SUBLANG_GREEK_GREECE
#pragma code_page(1253)
#endif //_WIN32

I compiled and tested the code below. No difference at all. Using CStringW it works. To be honest, I am not sure what exactly is going on here but I assume that VS2008 ignores the Greek character encoding?

CString strFormat;
strFormat.LoadString(136);


Just me!
Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2020 at 7:32am
Another paradox is when I use the debug executable I can see Greek characters in CXTPTaskDialog  but when I use release executable I get gibberish instead.

The character set in the General Settings of the project are both set to "Not set". What seems to be the problem here?


Just me!
Back to Top
sdancer75 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2008
Location: Greece
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote sdancer75 Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2020 at 8:47am
[Solved]

I don't know why this works and shows correctly the Greek characters, but the CXTPTaskDialog derived dialog should be called with TRUE in the 1st parameter to force use the ComCtl32.dll version of the task dialog. Unfortunately this concerns only for Vista and newer OSs

For example

CXTPTaskDialog tDialog(this);
tDialog.DoModal(TRUE);
Just me!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.