Ok heres the script I used to generate unicode file:
Look Ok?
##############################
my $ustring = "Hello \x{263A}!\n";

binmode STDOUT, ":utf8";
open FILE, ">:utf8", "OUT.txt";
print FILE "$ustring1$ustring2";
close(FILE);

# prove it
print "$ustring1$ustring2";

# prove it again
open FILE, "<:utf8", "OUT.txt";
@file = (<FILE>);
print @file;
close(FILE);
##############################


Then I read the file and put in textctrl&  listbox and it looked good.
Also print to STDOUT correctly - AND I did NOT have to use
the 'perl -C' or :utf8 encoding for things to work.

So I guess it is the strings that are being bad.

BUT how come the bad data show correctly on the command line if I use 'perl -C'?
And show correctly in Tk ?

I cannot modify the data - not my data.  What can I do to correct
or atleast get something other than a blank string ?

Thanks again.




On 8/4/2010 4:12 PM, Huub Peters wrote:
It's been a while since I've done stuff in wxPerl but I'm absolutely sure I 
could display unicode characters without problems.
What do you mean exactly when you say unicode? What is the used encoding? UTF-8?

Here are some ideas:
- Did you test Mattia's suggestion? Unicode and databases are known to cause 
weird troubles that are hard to identify
- Try creating a test app and let it read from a test textfile of which you are sure that it's UTF-8 
encoded ( maybe even create it with something like open(my $fh, ">:encoding(UTF-8)", 
"test.txt")
- As you mentioned in another reply, font can most definitely be a culprit. 
Lots of (older) fonts can't display characters beyond the ascii or latin-1 set.

Don't ditch wxPerl yet. It really is a powerful versatile toolset.

Cheers,
Huub

On Aug 4, 2010, at 9:53 PM, perltk wrote:

Has anyone got any ideas?  Unfortunately, this isn't an inconvience for us - 
this
is a show stopper.

Trying to move off perltk and the new Guis are looking good, but if we can not 
display
unicode characters wxperl is dead for us :-(


On 8/4/2010 8:16 AM, Mattia Barbon wrote:
perltk wrote:
I have an app that is reading from a database. Some of the names
include unicode characters:

Heres are some print statement output when running app:

   perl  uwi_flip.pl
    Well ==>   HENW_Letebr?nner

    perl -C uwi_flip.pl
    Well ==>   HENW_Letebrønner

Any names with these characters in them do not display in widgets - they are 
blank.
No errors, just blank.  The wxwidgets .so should be unicode.
  Yes, they are.

What am I missing ?????
  Are you sure that the strings you read from the database have the Unicode 
flag set when read from the database?  You can use the Dump() function from 
Devel::Peek to check if the scalar has the Unicode bit set.

  If the Unicode bit is not set on the scalar, the conversion from Perl scalar 
to wxString should use the encoding of your current locale, but I can't 
remember if if uses the system locale or (more likely) the locale set with 
wxLocale.

HTH,
Mattia



Reply via email to