Re: Converting from UTF-8 to ASCII for gecos field.

Prentice Bisbal <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
Graham Barr wrote:
> On Oct 14, 2010, at 13:47 , Prentice Bisbal wrote:
>> Greetings.
>>
>> Can anyone suggest a good way of converting a string from UTF-8 to IA5
>> (ASCII) for the gecos attribute. For example, I have the hypotheical
>> user Ërïç Cärtmân, with a lot of accented characters in his name
>> converting his name to ASCII using this code:
>>
>> my $gecos = encode('ascii', $cn);
>>
>> Turns it into this ugly mess:
>>
>> gecos: ?r?? C?rtm?n
>>
>> Anyone know of any decent perl functions that could turn it into
>> something more readable, like "Eric Cartman"?
> 
> Here are a couple of modules on CPAN that might be of some help
> 
> http://search.cpan.org/perldoc?Text::Undiacritic
> http://search.cpan.org/perldoc?Lingua::Translit
> 
> Graham.
> 
> 

Text::Undiacritic was exactly what I needed.

Thanks.


-- 
Prentice
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.