Re: Help with uc and lc and utf8

2004-11-06 Thread Robert Allerstorfer
Dan Kogai wrote:
Make sure:
* You have saved your script in UTF-8, not Latin1
* use utf8 to make sure string literals are treated as UTF-8 strings
* if you print, set filehandle layer to :utf8.
Try the sript below (be sure to save it in UTF-8).  I got KThe = 
kthe.

#
use strict;
use utf8;
my $fname = 'KThe';
my $lc_fname = lc($fname);
binmode STDOUT = :utf8;
print $fname = $lc_fname\n;
__END__
Or, if you want to keep your script in the Latin1 encoding and also want 
the output printed in Latin1 instead of UTF-8, I would use

use strict;
use Encode ();
my $fname = 'KThe';
$fname = Encode::decode('iso-8859-1', $fname, Encode::FB_XMLCREF);
my $lc_fname = lc($fname);
binmode STDOUT = :encoding(iso-8859-1);
print $fname = $lc_fname\n;
__END__
Is there any advantage in saving the script in UTF-8?
rob.


Help with uc and lc and utf8

2004-11-05 Thread Robert D Oden
I am not able to lower case a Ä. I am sure I am missing something simple 
but I have spent many hours researching and trying different things to 
no avail.

Any help would be appreciated!!
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.21-1.1931.2.393.entsmp, 
archname=i386-linux-thread-multi
uname='linux por'

LC_CTYPE = en_US.UTF-8
$fname = 'KÄThe'
@dec = unpack('C*', $fname);
@dec = 75 196 84 104 101
@hex = unpack('C*', $fname);
@hex = 4b c4 54 68 65
$lc_fname = lc($fname);
$lc_fname = kÄthe
@lc_dec = unpack('C*', $lc_fname);
@lc_dec = 107 196 116 104 101
@lc_hex = unpack('H*', $lc_fname);
@lc_hex = 6b c4 74 68 65



Re: Help with uc and lc and utf8

2004-11-05 Thread Dan Kogai
On Nov 06, 2004, at 15:21, Robert D Oden wrote:
I am not able to lower case a . I am sure I am missing something 
simple but I have spent many hours researching and trying different 
things to no avail.

Any help would be appreciated!!
Make sure:
* You have saved your script in UTF-8, not Latin1
* use utf8 to make sure string literals are treated as UTF-8 strings
* if you print, set filehandle layer to :utf8.
Try the sript below (be sure to save it in UTF-8).  I got KThe = 
kthe.

#
use strict;
use utf8;
my $fname = 'KThe';
my $lc_fname = lc($fname);
binmode STDOUT = :utf8;
print $fname = $lc_fname\n;
__END__
Summary of my perl5 (revision 5.0 version 8 subversion 0) 
configuration:
You should upgrade it to 5.8.1 or above (5.8.5 being the latest).  
5.8.0 was still premature unicode-wise.

Dan the Encode Maintainer