Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-05-01 Thread Johan Vromans
Mark Dootson mark.doot...@znix.com writes: On 30/04/2013 19:19, Johan Vromans wrote: We may assume that the Perl string is in Perl's internal encoding. No we may not. In that case you'll run into all kinds of encoding problems anyway. See e.g. perlunitut. I kind of like the existing

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-05-01 Thread Mark Dootson
Hi, On 01/05/2013 07:34, Johan Vromans wrote: Mark Dootson mark.doot...@znix.com writes: On 30/04/2013 19:19, Johan Vromans wrote: We may assume that the Perl string is in Perl's internal encoding. No we may not. In that case you'll run into all kinds of encoding problems anyway. If

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-05-01 Thread Mark Dootson
chars, so I think the char is added well in DB. --Octavian - Original Message - From: Mark Dootson mark.doot...@znix.com To: steveco.1...@gmail.com; wxperl-users@perl.org Sent: Monday, April 29, 2013 4:32 PM Subject: Re: Can we print UTF-8 chars in Wx::TextCtrl fields? Hi, A Perl

RE: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-05-01 Thread steveco.1959
Hi Guys, Well, this morning I'm inclined to agree that this ought to be the case. At least for: $orig = readline($datafile); $line = decode( 'UTF-8', $orig ); $w = Wx::StaticText-new( ... ); $w-SetLabel($line); On the other hand I'm reluctant to introduce something that I'm certain

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-05-01 Thread Mark Dootson
Hi, On 01/05/2013 16:49, steveco.1...@gmail.com wrote: Well all this just serves to deepen my confusion. 1) What is the difference between: $line = decode( 'UTF-8', $orig ); and $line = decode( 'utf8', $orig ); Always use decode( 'UTF-8', $orig ); 'UTF-8' means what it says. In my

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-05-01 Thread Octavian Rasnita
: Wednesday, May 01, 2013 8:18 PM Subject: Re: Can we print UTF-8 chars in Wx::TextCtrl fields? Hi, Just a clarification. Setting the font so that you get glyphs displayed properly is only an issue on Windows XP. More recent versions of Windows have default GUI fonts that have a much wider

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-05-01 Thread Mark Dootson
Hi, On 01/05/2013 20:14, Octavian Rasnita wrote: Yep, good to know. It would be nice if WxPerl would announce somehow that a font doesn't have the necessary glifs (maybe with a warning). Nice to have, but there is no reasonable and practical implementation I can think of. I am aware of how

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-30 Thread Mark Dootson
Hi, On 30/04/2013 15:38, Johan Vromans wrote: 2. This data is the current default format fro wxWidgets. Which I understand it may work if you're lucky. I am of the opinion that this bit ( WXSTRING_INPUT ) already works as well as it can do if given an SV and no other params. I certainly

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-30 Thread Johan Vromans
Mark Dootson mark.doot...@znix.com writes: Only if the input actually is valid UTF-8. Something only the Perl coder can know / ensure. It isn't a requirement of the wxWidgets library. We may assume that the Perl string is in Perl's internal encoding. So I think it would be safe to encode the

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-30 Thread Octavian Rasnita
: Mark Dootson mark.doot...@znix.com To: steveco.1...@gmail.com; wxperl-users@perl.org Sent: Monday, April 29, 2013 4:32 PM Subject: Re: Can we print UTF-8 chars in Wx::TextCtrl fields? Hi, A Perl scalar has a character buffer to store character or byte data. This data can be interpreted and stored

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-30 Thread Mark Dootson
is added well in DB. --Octavian - Original Message - From: Mark Dootson mark.doot...@znix.com To: steveco.1...@gmail.com; wxperl-users@perl.org Sent: Monday, April 29, 2013 4:32 PM Subject: Re: Can we print UTF-8 chars in Wx::TextCtrl fields? Hi, A Perl scalar has a character buffer

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-30 Thread Octavian Rasnita
To: Octavian Rasnita orasn...@gmail.com Cc: steveco.1...@gmail.com; wxperl-users@perl.org Sent: Tuesday, April 30, 2013 10:43 PM Subject: Re: Can we print UTF-8 chars in Wx::TextCtrl fields? Hi, Comment out the line $text = decode('utf8', $text ); you do not need it. Change the font name requested

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-29 Thread Mark Dootson
I would guess you are working on Windows? wxVSCROLL isn't in the list of styles available for wxTextCtrl. It isn't needed. Remove it and all works OK. It seems you can get away with it on Linux - but not on Windows. For the Wx::Font you can just do my $font = Wx::Font-new( $FontSize},

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-29 Thread Mark Dootson
Hi, If your Perl scalar contains UTF-8 encoded text and is marked as such, then you shouldn't need any decoding functions. (Well, that is how it is supposed to work. If it doesn't, it is a bug). So, yes - if your scalars contain UTF-8 encoded text and are marked as such, that's all you

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-29 Thread Johan Vromans
Mark Dootson mark.doot...@znix.com writes: I would guess you are working on Windows? wxVSCROLL isn't in the list of styles available for wxTextCtrl. It isn't needed. Remove it and all works OK. It seems you can get away with it on Linux - but not on Windows. Ah! I was misled by the

RE: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-29 Thread steveco.1959
Solution - your conversion of external data should be my $string = decode($encoding, $binary); utf8::upgrade($string); This should be platform independent and work - always. Perl's string functions should all work OK on $string. So you are saying that if I change $var =

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-29 Thread Johan Vromans
steveco.1...@gmail.com writes: As it is at the moment, I just use decode and I don't get any errors. But I do need to use decode. Whenever you bring data from outside Perl into Perl, you should decode it. If the data is ASCII (actually: Latin-1) it doesn't matter much, but if the data is

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-29 Thread Octavian Rasnita
Hi Mark, Thank you for this great explanation. Much clearer than other documentations. --Octavian - Original Message - From: Mark Dootson mark.doot...@znix.com To: steveco.1...@gmail.com; wxperl-users@perl.org Sent: Monday, April 29, 2013 4:32 PM Subject: Re: Can we print UTF-8

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-29 Thread Johan Vromans
Mark Dootson mark.doot...@znix.com writes: #define WXSTRING_INPUT( var, type, arg ) \ var = ( SvUTF8( arg ) ) ? \ wxString( SvPVutf8_nolen( arg ), wxConvUTF8 ) \ : wxString( SvPV_nolen( arg ), wxConvLibc ); So basically, if the scalar is marked as 'utf8' then it gets

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-29 Thread Mark Dootson
Hi, On 29/04/2013 20:06, Johan Vromans wrote: I'd say this is the wrong approach. The solution is to adjust the WXSTRING_PUT macro to check for the utf8 flag and handle accordingly. -- Johan That's exactly what it does, unless I've misunderstood. Regards Mark

Re: Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-29 Thread Johan Vromans
Mark Dootson mark.doot...@znix.com writes: Hi, On 29/04/2013 20:06, Johan Vromans wrote: I'd say this is the wrong approach. The solution is to adjust the WXSTRING_PUT macro to check for the utf8 flag and handle accordingly. That's exactly what it does, unless I've misunderstood. If it

Can we print UTF-8 chars in Wx::TextCtrl fields?

2013-04-22 Thread Octavian Rasnita
Hi, I have a text field defined as: $self-{defs} = Wx::TextCtrl-new( $self-{panel}, -1, , wxDefaultPosition, [ 500, 400 ], wxTE_MULTILINE | wxTE_READONLY | wxVSCROLL | wxTE_PROCESS_ENTER | wxTE_RICH2 ); And I am trying to set a font for