Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Converting from UTF-8 to ASCII for gecos field.
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Peter Karman  
View profile  
 More options Oct 14 2010, 3:07 pm
Newsgroups: perl.ldap
From: pe...@peknet.com (Peter Karman)
Date: Thu, 14 Oct 2010 14:07:38 -0500
Local: Thurs, Oct 14 2010 3:07 pm
Subject: Re: [Net::LDAP] Converting from UTF-8 to ASCII for gecos field.
Prentice Bisbal wrote on 10/14/10 1:47 PM:

> 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"?

use Search::Tools::Transliterate;

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

my $gecos = $ascifier->convert($gecos);

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.