kanegr has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know if it is possible to change the character set of an open windows window? For instance change the character set from ansi to symbol. I know you can do stuff to windows with the win32::API but I'm not sure if you can change the character set used by a window. Does anyone know how win32::API or otherwise. An example or a pointing in the right direction would be greatly appreciated!

Replies are listed 'Best First'.
Re: Change the charset for a window
by BrowserUk (Patriarch) on Sep 05, 2008 at 23:18 UTC
    I know you can do stuff to windows with the win32::API but I'm not sure if you can change the character set used by a window.

    What do you mean by "character set"? You can change both the input and output codepages (see Win32::Console). If you're on Vista or Server2008 you can set the font, but not prior to that. That new functionality isn't (yet) a part of Win32::Console so you'd have to resort to Win32::API


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Well you can change the font of a win32 window using win32::API You get the handle on the window and then pass wm_setfont to the window. But the documentation on how to use it properly and efficiently is poor. I was just wondering if you could set the character set to 2(symbol). I think the default is 0(ansi).

        Sorry. I got the wrong end of the stick and thought you were asking to change a console window font.

        After a quick browse, I'm guessing that you would have to create a new font with the same characteristics as the existing one, but a different character set. But I don't see any way of going from the HFONT returned by WM_GETFONT back to the parameters from which it was created. I think you'll have to go to a windows specific forum for the help you need.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Change the charset for a window
by ikegami (Patriarch) on Sep 05, 2008 at 22:25 UTC
    I don't know the answer either way, but it's probably relevant to know if this is a window you created or an arbitrary window.