Octavian Rasnita wrote on 12/16/2008 10:14 AM:
> From: "Peter Karman" <pe...@peknet.com>
>> or Search::Tools::Transliterate
> 
> I have tried:
> 
> use strict;
> use Search::Tools::Transliterate;
> use utf8;
> 
> my $tr = Search::Tools::Transliterate->new;
> $tr->ebit(0);
> print $tr->convert("ăşţâîĂŞŢÂÎ????");
> 
> #It prints:
> astâîASTÂÎ????
> 
> I want to print ai instead of âî and AI instead of ÂÎ. Am I using
> $tr->ebit correctly?
> 

no. you must set ebit in new(), not after instantiation. I've added a
note to the docs to emphasize that.

my $tr = Search::Tools::Transliterate->new( ebit => 0 );

> The latest 4 chars are 4 new UTF-8 chars in romanian language (U+0218,
> U+0219, U+021A, U+021B). Can they be transliterated?
> They are şŞţŢ but with a comma below, and not with a sedila. Can they be
> displayed as sStT?

sure. Just add them via the map() method. I believe that's documented
with an example, but here's another:

---------------------------
#!/usr/bin/perl
use strict;
use Search::Tools::Transliterate;
use utf8;

binmode STDERR, ':utf8';

my $string = "ăşţâîĂŞŢÂÎ";

# new romanian utf8 chars
$string .= "\x{0218}";
$string .= "\x{0219}";
$string .= "\x{021A}";
$string .= "\x{021B}";

my $tr = Search::Tools::Transliterate->new(ebit=>0);
$tr->map->{"\x{0218}"} = 's';
$tr->map->{"\x{0219}"} = 'S';
$tr->map->{"\x{021A}"} = 't';
$tr->map->{"\x{021B}"} = 'T';

print STDERR $string . "\n";
print STDERR $tr->convert($string) . "\n";

------------------

I added the above code as part of a new test and just uploaded 0.19 to
cpan.

If you have suggestions for permanent additions/changes to the character
mapping file, please open a RT ticket and I'll see that they get
reviewed for a future release.

Thanks for the feedback.


-- 
Peter Karman  .  pe...@peknet.com  .  http://peknet.com/


_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to