Lazarus

Programming => Widgetset => QT => Topic started by: Ocye on September 15, 2012, 01:12:39 pm

Title: Dialogs does not show non-latin chars with Qt on Darwin
Post by: Ocye on September 15, 2012, 01:12:39 pm
A simple ShowMessage('Bär') (->B??r) or ShowMessage('ада') (-> ??????) as well MessageDlg() don't work with Qt on Darwin. Can someone confirm this bug?

Carbon@Darwin and Qt@Linux both are okay, but not Qt@Darwin (always compiled with {$H+}).

Lazarus updates recently from svn, FPC 2.6.0
Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: zeljko on September 15, 2012, 09:51:33 pm
Have you included cwstring unit ?
Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: Ocye on September 15, 2012, 10:52:25 pm
Have you included cwstring unit ?
I didn't before. But it does not help either.
Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: zeljko on September 16, 2012, 11:20:17 am
I had some problems with mac also, but fixed it by adding LANG variable into macosx startup file.
so:
1.Create directory $HOME/.MacOSX  (it's hidden dir - have dot in front of it)
2.Inside $HOME/.MacOSX create file environment.plist (you can do that by mac tool to create plist's ... don't know name atm)
3.Inside that file must be <key>LANG</key> <string>yourlocale_YOURLOCALE.UTF-8</string>
eg. I have <string>hr_HR.UTF-8</string>.
Logout, and then login again so changes are visible to system.

Before you create anything you can test that from terminal.

export LANG=yourlocale_YOURLOCALE.UTF-8
cd YourProject.app/Contents/MacOS
./yourproject <PRESS ENTER>




Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: Ocye on September 16, 2012, 12:01:22 pm
When I export LANG=de_DE.UTF8 the umlaut with ShowMessage() is still not shown, neither with or without cwstring. Carbon works as expected. LC_TYPE is UTF8.
And, last but not least, it would be a problem to set the LANG id for users.

PS: Maybe it's an interesting fact that "with CreateMessageDialog('Bär',mtConfirmation],[mbOk]) do ShowModal" is okay.
Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: zeljko on September 16, 2012, 06:43:27 pm
It's not de_DE.UTF8 but de_DE.UTF-8
Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: Bart on September 16, 2012, 06:51:28 pm
PS: Maybe it's an interesting fact that "with CreateMessageDialog('Bär',mtConfirmation],[mbOk]) do ShowModal" is okay.

CreateMessageDialog() doesn't use native dialog, it is a plain TForm that displays the message and the buttons, like any other LCL widget.
It is used as a fallback for widgetsets that do not provide a native dialog (like on win9x/winxp).
MessageDlg() probably calls native QT dialog, hence the difference.

Bart
Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: zeljko on September 16, 2012, 07:33:39 pm
But native dialog uses same strings translation like any other control afaik. eg.
QMessageDialog_setTitle(GetUTF8String(MyString)) is called.
Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: Ocye on September 16, 2012, 08:26:51 pm
It's not de_DE.UTF8 but de_DE.UTF-8
No success. I feel stupid  %)
BTW: Lazarus itself does no show umlauts. Probably I have to blame my configuration.
Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: zeljko on September 18, 2012, 06:44:59 pm
It's really strange, I don't have such problems on mac using LANG=hr_HR.UTF-8 ...
Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: Ocye on September 27, 2012, 03:08:52 pm
Memo.Lines is affected as well. If I add strings at the designer, like Bär, it is shown as B??r. And after reopening property editor for lines that memo contains B??r. So I must get converted by Lazarus.
Title: Re: Dialogs does not show non-latin chars with Qt on Darwin
Post by: zeljko on September 27, 2012, 06:40:33 pm
Please open an issue about it and attach example with your strings inside.
TinyPortal © 2005-2018