Home: Perl Programming Help: Win32 Programming Help:
How use UTF8 (persian) in Win32::GUI



mohsenalizadeh
Novice

Mar 26, 2010, 4:44 AM


Views: 7638
How use UTF8 (persian) in Win32::GUI

I have problem to write with UTF8 chatachters in Win32::GUI.
please help me.
thankyou.


(This post was edited by mohsenalizadeh on Mar 26, 2010, 8:12 AM)


mohsenalizadeh
Novice

Apr 4, 2010, 9:02 AM


Views: 7560
Re: [mohsenalizadeh] How use UTF8 (persian) in Win32::GUI

I use this methods :


Code
sub t2w { 
my ($text) = @_;
return encode("UTF-16LE", $text . "\x00");
}

our $SetWindowTextW_fn = undef;
sub text {
my ($control, $text) = @_;
if (not $SetWindowTextW_fn) {
$SetWindowTextW_fn = Win32::API->new("user32", "SetWindowTextW",
"NP", "N");
die unless $SetWindowTextW_fn;
}
$SetWindowTextW_fn->Call($control->{-handle}, t2w($text));
}

and use :

Code
text($owner,$title);