Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

locale confusion

by phenom (Chaplain)
on Apr 24, 2005 at 13:16 UTC ( #450941=perlquestion: print w/replies, xml ) Need Help??
phenom has asked for the wisdom of the Perl Monks concerning the following question:

Hello all,

What I would like is to enable users to view (letters|characters) in their native format (for my Tk/Gtk2 programs). I've read this, this, this, this, perllocale, and more, and I'm still not understanding.

On my end, so long as I have the line "use encoding 'utf8'" in there, I can see things just fine (screenshot). However, users with other locale/language settings (ie., cp1251, ru_RU.CP1251) are unable to do so. Again, unlike the examples I've seen, I do not know in advance what their settings are.

Given the other nodes, will adding the following help?

use locale; use POSIX qw/locale_h/; my $encoding = setlocale(LC_CTYPE); setlocale(LC_CTYPE, $encoding);

Replies are listed 'Best First'.
Re: locale confusion
by zentara (Archbishop) on Apr 25, 2005 at 12:58 UTC
    Hi, you might find some clues from this gtk2 tutorial

    Dov's gtk2 tutorial

    Although I've had trouble getting his unicode example to display properly. He uses a BEGIN block to set locale.

    I'm not really a human, but I play one on earth. flash japh

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://450941]
Approved by castaway
[ambrus]: Hopefull the object isn't kept alive, the events are processed immediately, but you'd have to read a lot of source code to be sure about that.
[Corion]: ambrus: I think both of AnyEvent and Prima are pretty tight in their memory management because they both are cooperative multitasking and (I think) both use the Perl memory management for managing things
[Corion]: ambrus: And for Windows, I don't think that Prima knows if there still are messages queued for an object (in the Windows message loop). Finding that out would take lots of effort for little gain
[ambrus]: And even if this works, I'm still not sure you can't get double timeouts from a Timer.
[ambrus]: Corion: well Prima::Object says something like that the cleanup method will send an onDestory message and that you can't get more messages after cleanup, or something.
[Corion]: ambrus: Yeah - I don't think the deep source dive will be necessary if things are implemented as simple as they could be :)) And hopefully I won't need (more) timely object destruction. I can update the screen at 60Hz and hopefully even do HTTP ...
[Corion]: ... transfers in the background. Now that I think about it, this maybe even means that I can run the OpenGL filters on Youtube input :)
[ambrus]: Corion: I mentioned that the unix event loop of Prima always wakes up at least once every 0.2 seconds. Have you found out whether the win32 event loop of Prima does that too?
[Corion]: ambrus: Hmm - I would assume that the onDestroy message is sent from the destructor and doesn't go through the messageloop, but maybe it is sent when a window gets destroyed but all components are still alive...
[ambrus]: Corion: partly deep source dive, partly just conservative coding even if it adds an overhead.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2016-12-09 10:25 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (150 votes). Check out past polls.