Unicode characters displaying as ANSI on windows title bar

Post Reply
User avatar
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Unicode characters displaying as ANSI on windows title bar

Post 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.

https://stackoverflow.com/questions/33 ... title-bar

This is the original code:

Code: Select all

// 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

// 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
 
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Unicode characters displaying as ANSI on windows title bar

Post by cnavarro »

Tested in my Server 2012
Tested with Fw_SetUnicode (.T.) And without Fw_SetUnicode in Windows Server 2012

Image
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Re: Unicode characters displaying as ANSI on windows title bar

Post 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
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Unicode characters displaying as ANSI on windows title bar

Post 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
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Unicode characters displaying as ANSI on windows title bar

Post by cnavarro »

Robb, tested with VSC 2015 ( Harbour ) and create childs windows

Image
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Unicode characters displaying as ANSI on windows title bar

Post by cnavarro »

Also, with title in MDI window, and child windows ( with VSC 2015 and Harbour, in Server 2012 )

Image
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: Unicode characters displaying as ANSI on windows title bar

Post 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
Regards,

Richard

Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Unicode characters displaying as ANSI on windows title bar

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Unicode characters displaying as ANSI on windows title bar

Post by nageswaragunupudi »

Mr. Richard

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

Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: Unicode characters displaying as ANSI on windows title bar

Post 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?
Regards,

Richard

Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Unicode characters displaying as ANSI on windows title bar

Post 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

ACTIVATE WINDOW oMdiChild
RELEASE ICON oIco
 
Please do not do that. Instead do this:

Code: Select all

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

return nil
 
In this sample, the icon of the mdichild is never lost:

Code: Select all

#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
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Re: Unicode characters displaying as ANSI on windows title bar

Post 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

ACTIVATE WINDOW oMdiChild
RELEASE ICON oIco
 
Please do not do that. Instead do this:

Code: Select all

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

return nil
 
In this sample, the icon of the mdichild is never lost:

Code: Select all

#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.
Regards,

Richard

Harbour 3.2.0dev (r1904111533)/xHarbour 1.2.3 Intl. (SimpLex) (Build 20180818) => Borland C++ v7.4
xHarbour 0.99.71 (SimpLex) => Borland C++ v5.5
MySQL v5.7 /ADS v12
Harbour 3.2.0dev (r1603181642) => Borland C++ v7.4 64bit
Post Reply