Recent

Author Topic: Dialogs does not show non-latin chars with Qt on Darwin  (Read 7327 times)

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Dialogs does not show non-latin chars with Qt on Darwin
« 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
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #1 on: September 15, 2012, 09:51:33 pm »
Have you included cwstring unit ?

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #2 on: September 15, 2012, 10:52:25 pm »
Have you included cwstring unit ?
I didn't before. But it does not help either.
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #3 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>





Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #4 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.
« Last Edit: September 16, 2012, 12:10:04 pm by Ocye »
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #5 on: September 16, 2012, 06:43:27 pm »
It's not de_DE.UTF8 but de_DE.UTF-8

Bart

  • Hero Member
  • *****
  • Posts: 3518
    • Bart en Mariska's Webstek
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #6 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

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #7 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.

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #8 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.
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #9 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 ...

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #10 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.
Lazarus 1.7 (SVN) FPC 3.0.0

zeljko

  • Hero Member
  • *****
  • Posts: 1054
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Dialogs does not show non-latin chars with Qt on Darwin
« Reply #11 on: September 27, 2012, 06:40:33 pm »
Please open an issue about it and attach example with your strings inside.