Dear Cordeiro, I wrote some lines of code to produce a translation from <"portuguese" character set> to <"regular" alpha char set>. Does anybody has any idea to enhance this code or a perl module to replace it?
<code> %charset = ( "á" => "a", "Á" => "A", "ã" => "a", "Ã" => "A", "à" => "a", "À" => "A", "é" => "e", "É" => "E", "ê" => "e", "Ê" => "E", "í" => "i", "Í" => "I", "ó" => "o", "Ó" => "O", "ô" => "o", "Ô" => "O", "õ" => "o", "Õ" => "O", "ú" => "u", "Ú" => "U", "ü" => "u", "Ü" => "U", "ç" => "c", "Ç" => "C", " " => "-", "\-" => "_", "\+" => "_" ); $title = 'Serviço de Saúde áÁ ãà àÀ éÉ êÊ íÍ óÓ ôÔ õÕ úÚ üÜ çÇ +-'; for ($i=0;$i<length($title);$i++){ $char = substr($title,$i,1); if ($charset{$char}){ $title =~ s/[$char]/$charset{$char}/g; } } print "\n\r", $title; </code> I hope it help you. Josimar Nunes de Oliveira ----- Original Message ----- From: "Duarte Cordeiro" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 20, 2002 5:36 AM Subject: converting "strange" characters Hi, As everyone, I have a bunch of "titles" to parse. For each title I must create a directory with a similar name, and within that directory a file called area.txt that has the title name inside. No problem with that, but the directory names can't contain spaces, quote, double quote... that part I already figured it out. But my problem is within the "portuguese" character set. So in a title like: $title="Serviço de Saúde"; I need to create a: Servico_de_Saude directory. already tried: $o=ord(substr($name,5,1); $o becomes 231 $title=~s/\x{231}/c/g; to see if I can get que ç to a c but no change takes place. Is there a generic way of converting these characters to "regular" alpha? and if not, how can I get a match on that specific character ? Thanks in advance, Duarte Cordeiro -- Duarte Manuel Cordeiro Manager - IT - Security & Communications mailto:[EMAIL PROTECTED] | msn: [EMAIL PROTECTED] | http://www.neoris.com/ -- Neoris Portugal Edificio Inovação IV - Sala 819 - Taguspark * 2780-920 Oeiras * Portugal Tel: +351 21 423-8350 | Fax: +351 21 421-7626 | Mob: +35191 613-5706 -- Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of my firm shall be understood as neither given nor endorsed by it. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]