I'm trying to get a useful Perl representation of the Unicode string
edited by the user in a RichEdit. It turned out that if I use
$RichEdit->Text, some Unicode characters are corrupted (transformed to
Latin equivalents). The same happens for GetSelText.

In other words, $RichEdit->Text($RichEdit->Text) corrupts the text!

I looked in RichEdit.xs, then at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/richedit/richeditcontrols/richeditcontrolreference/richeditmessages/em_setoptions.asp
, but I couldn't figure out a fix.

So is there a way to retrieve the intact Unicode content of a RichEdit?
The code below demonstrates the problem (should I submit it as a bug?).

Or, is there a way to retrieve the RTF behind the RichEdit, other than
by doing a Save and reading the file?

Thanks,
Dan

#! perl -w
use strict;
use Win32::GUI;

my $w = Win32::GUI::Window->new(
    -name => 'Main',
    -size => [800, 600],
);

my $re = $w->AddRichEdit(
    -size => [600, 400],
);

$w->AddButton(
    -name => 'btnChange',
    -pos => [600, 500],
    -text => '$re->Text($re->Text)',
);

my $rtf_prolog = '{\rtf1\ansi\deff0
{\fonttbl{\f0 \fcharset1\fnil Times New Roman;}}
{\stylesheet {\*\cs0 \additive Default Paragraph Font;}}';

$re->Text($rtf_prolog . 'This, \u305?, is not exactly the letter i' . '}');

sub btnChange_Click {
    $re->Text($re->Text);
}


$w->Show;

Win32::GUI::Dialog();

sub Main_Terminate {
    -1;
}

Reply via email to