Page 1 of 1

Unicode characters displaying as ANSI on windows title bar

PostPosted: Thu Jul 05, 2018 5:24 pm
by rhlawek
I brought this issue up a long time ago. I never fixed it but I did just spend the last few minutes trying to isolate it to root cause.

It appears to only happen with an MDI window, and can be reproduced by a simple edit of c:\fwh\samples\mdi.prg. This issue doesn't show up everywhere, for example I don't see the issue on Windows 10 but I see it everywhere on Server 2008 and Server 2012.

This link provides a reasonable explanation of what is going on. What I don't understand yet is why I'm only seeing it on server operating systems.

[url]
https://stackoverflow.com/questions/333 ... -title-bar
[/url]

This is the original code:

Code: Select all  Expand view

// Testing FiveWin for Harbour MDI Windows support

#include "FiveWin.ch"

function Main()

   local oWnd

   DEFINE WINDOW oWnd MDI ;
      TITLE "A sample of a MDI environment"

   ACTIVATE WINDOW oWnd

return nil
 


Edited code adding only FW_SetUnicode( .T. ) will result in a title bar that is trying to display unicode characters on a window that actually gets created as an ANSI window. Antonio, I'll email you a screen shot of the bad display.

Code: Select all  Expand view

// Testing FiveWin for Harbour MDI Windows support

#include "FiveWin.ch"

function Main()

   local oWnd

   FW_SetUnicode( .T. )

   DEFINE WINDOW oWnd MDI ;
      TITLE "A sample of a MDI environment"

   ACTIVATE WINDOW oWnd

return nil
 

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Thu Jul 05, 2018 6:31 pm
by cnavarro
Tested in my Server 2012
Tested with Fw_SetUnicode (.T.) And without Fw_SetUnicode in Windows Server 2012

Image

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Thu Jul 05, 2018 6:40 pm
by rhlawek
Thank you for testing. Very odd. Which compiler are you using? I'm only using msvc and msvc64, I should have made that clear. Also, I don't see it happening on the child windows, only the main window. Which tells me the main window is getting created ANSI but the children are getting created correctly for unicode.

Robb

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Thu Jul 05, 2018 6:48 pm
by cnavarro
rhlawek wrote:Thank you for testing. Very odd. Which compiler are you using? I'm only using msvc and msvc64, I should have made that clear. Also, I don't see it happening on the child windows, only the main window. Which tells me the main window is getting created ANSI but the children are getting created correctly for unicode.

Robb

Borland and Harbour
Ok, I try test in same enviroment with child windows

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Thu Jul 05, 2018 6:55 pm
by cnavarro
Robb, tested with VSC 2015 ( Harbour ) and create childs windows

Image

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Thu Jul 05, 2018 7:07 pm
by cnavarro
Also, with title in MDI window, and child windows ( with VSC 2015 and Harbour, in Server 2012 )

Image

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Fri Jul 05, 2019 6:22 pm
by richard-service
cnavarro wrote:Also, with title in MDI window, and child windows ( with VSC 2015 and Harbour, in Server 2012 )

Image


Mr.Cristobal Navarro

My PRG save as utf8 with BOM and use Harbour and MDI+Resource Dialog
HB_LangSelect( "zh" )
HB_SetCodePage( "UTF8" )
HB_CDPSELECT( "UTF8" )

Fw_SetUnicode( .T. )

My Child Window Title not show Chinese characters. If use SDI, Resource Dialog Title work fine.
So... Any Idea?

Image

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Fri Jul 05, 2019 11:43 pm
by nageswaragunupudi
Mr. Richard

You are right. Child window titles are not displayed in Unicode.
Thanks for bringing this to our notice.
We will look into this.

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Sat Jul 06, 2019 1:48 am
by nageswaragunupudi
Mr. Richard

This is now fixed in FWH1906 soon to be released. Thanks again for bringing this to our notice.

Image

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Sun Jul 07, 2019 3:13 am
by richard-service
nageswaragunupudi wrote:Mr. Richard

This is now fixed in FWH1906 soon to be released. Thanks again for bringing this to our notice.

Image


Mr.RAO

I move Child Window anywhere in my screen. I found Child Window ICON Disappear(look my Previous post). Any idea or it's bug?

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Sun Jul 07, 2019 4:55 am
by nageswaragunupudi
I move Child Window anywhere in my screen. I found Child Window ICON Disappear(look my Previous post). Any idea or it's bug?

You may be losing it when resizing, but not when moving.
The most likely reason is that you are releasing the Icon after Activating the mdichild window like this:
Code: Select all  Expand view

ACTIVATE WINDOW oMdiChild
RELEASE ICON oIco
 


Please do not do that. Instead do this:
Code: Select all  Expand view

oMdiChild:bPostEnd := { || oIco:End() }
ACTIVATE WINDOW oMdiChild

return nil
 


In this sample, the icon of the mdichild is never lost:
Code: Select all  Expand view

#include "fivewin.ch"

function Main()

   local oWnd, oBar

   FW_SetUnicode( .t. )

   DEFINE WINDOW oWnd MDI TITLE "తెలుగు భాష"
   DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2007
   DEFINE BUTTON PROMPT "బటను" OF oBar ACTION Child()
   ACTIVATE WINDOW oWnd

return nil

static function Child()

   local oWnd, oIco, cText := Space( 40 )

   DEFINE ICON oIco FILE "c:\fwh\icons\books.ico"

   DEFINE WINDOW oWnd MDICHILD OF WndMain() ;
      TITLE "ఛైల్డు విండో" ICON oIco

   @ 40,40 GET cText SIZE 200,24 PIXEL OF oWnd

   @ 90,40 BUTTON "ఓకే (OK)" SIZE 100,30 PIXEL OF oWnd ;
      ACTION MsgInfo( cText )

   oWnd:bPostEnd := { || oIco:End() }

   ACTIVATE WINDOW oWnd

return nil
 

Re: Unicode characters displaying as ANSI on windows title bar

PostPosted: Sun Jul 07, 2019 7:44 am
by richard-service
nageswaragunupudi wrote:
I move Child Window anywhere in my screen. I found Child Window ICON Disappear(look my Previous post). Any idea or it's bug?

You may be losing it when resizing, but not when moving.
The most likely reason is that you are releasing the Icon after Activating the mdichild window like this:
Code: Select all  Expand view

ACTIVATE WINDOW oMdiChild
RELEASE ICON oIco
 


Please do not do that. Instead do this:
Code: Select all  Expand view

oMdiChild:bPostEnd := { || oIco:End() }
ACTIVATE WINDOW oMdiChild

return nil
 


In this sample, the icon of the mdichild is never lost:
Code: Select all  Expand view

#include "fivewin.ch"

function Main()

   local oWnd, oBar

   FW_SetUnicode( .t. )

   DEFINE WINDOW oWnd MDI TITLE "తెలుగు భాష"
   DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2007
   DEFINE BUTTON PROMPT "బటను" OF oBar ACTION Child()
   ACTIVATE WINDOW oWnd

return nil

static function Child()

   local oWnd, oIco, cText := Space( 40 )

   DEFINE ICON oIco FILE "c:\fwh\icons\books.ico"

   DEFINE WINDOW oWnd MDICHILD OF WndMain() ;
      TITLE "ఛైల్డు విండో" ICON oIco

   @ 40,40 GET cText SIZE 200,24 PIXEL OF oWnd

   @ 90,40 BUTTON "ఓకే (OK)" SIZE 100,30 PIXEL OF oWnd ;
      ACTION MsgInfo( cText )

   oWnd:bPostEnd := { || oIco:End() }

   ACTIVATE WINDOW oWnd

return nil
 


Mr.RAO

Now, it's working now.