Name Converting

A signature and avatar generator addon

Moderator: zanix

Name Converting

Postby Rothin » Sun Mar 11, 2007 6:32 am

I was just curious if there was a way to make Siggen convert ASCII names into normal ones when it creates the images?

An example would be:

sig-Ôutlåw.jpg
to
sig-Outlaw.jpg

Is that possible to do at all? Or should I just try to keep those names out of my guild in general? On my host, it's a pain to edit/delete the images with the special characters in the names.
Rothin
WR.net Apprentice
WR.net Apprentice
 
Posts: 18
Joined: Wed Jul 05, 2006 2:39 pm

Name Converting

Postby zanix » Sun Mar 11, 2007 8:54 am

You can convert the letters, but there is no simple php function to handle this

You would need a list of every character that you want to convert
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Name Converting

Postby Rothin » Mon Mar 12, 2007 4:33 pm

Doh, I was afraid you were going to say something like that. lol

I wish Blizzard would just restrict those characters on North American realms like other MMOs do.

Anyways, how would I go about it for specific cases? I still have one character in the guild at the moment who has one letter so if I could convert theirs it would work for the time being. :)
Rothin
WR.net Apprentice
WR.net Apprentice
 
Posts: 18
Joined: Wed Jul 05, 2006 2:39 pm

Name Converting

Postby leoncx » Mon Mar 12, 2007 4:49 pm

This is a PHP function for replace accents

Code: Select all
function without_accent($string)
{
   $accent  ="ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ";
   $noaccent="aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyyby";
   return strtr(trim($string),$accent,$noaccent);
}


This function work with almost all the accents.
leoncx
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 15
Joined: Tue Feb 06, 2007 5:48 am

Name Converting

Postby Rothin » Mon Mar 12, 2007 6:45 pm

Cool thanks!

So where would I plug that into the siggen/roster to convert those?
Rothin
WR.net Apprentice
WR.net Apprentice
 
Posts: 18
Joined: Wed Jul 05, 2006 2:39 pm

Name Converting

Postby zanix » Wed Mar 14, 2007 1:15 am

I'll have to add this as an option in SigGen
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Name Converting

Postby Rothin » Wed Mar 14, 2007 5:35 am

Thanks Zanix, I look forward to that one! :)
Rothin
WR.net Apprentice
WR.net Apprentice
 
Posts: 18
Joined: Wed Jul 05, 2006 2:39 pm

Re: Name Converting

Postby arwenn » Wed Jun 27, 2007 8:27 pm

Hi,

I've activated option "Convert Accents", I've modified siggen.php :

Code: Select all
   function removeAccents($string)
   {
      return strtr($string,
         "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
         "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn");
   }


By this one :
Code: Select all
function removeAccents($string)
   {
      $accent  ="ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ";
      $noaccent="aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyyby";
      return strtr(trim($string),$accent,$noaccent);
   }


And I've tried :
Code: Select all
$replace = array(
    "Å " => "Š", "Å¡" => "š", "Å'" => "Œ", "Å\"" => "œ",
    "Ÿ" => "Ÿ", "ÿ" => "ÿ", "À" => "À", "à " => "à",
    "Á" => "Á", "á" => "á", "Â" => "Â", "â" => "â",
    "Ã" => "Ã", "ã" => "ã", "Ä" => "Ä", "ä" => "ä",
    "Ã…" => "Å", "Ã¥" => "å", "Æ" => "Æ", "æ" => "æ",
    "Ç" => "Ç", "ç" => "ç", "È" => "È", "è" => "è",
    "É" => "É", "é" => "é", "Ê" => "Ê", "ê" => "ê",
    "Ë" => "Ë", "ë" => "ë", "ÃŒ" => "Ì", "ì" => "ì",
    "Í" => "Í", "í" => "í", "ÃŽ" => "Î", "î" => "î",
    "Ï" => "Ï", "ï" => "ï", "Ð" => "Ð", "ð" => "ð",
    "Ã'" => "Ñ", "ñ" => "ñ", "Ã'" => "Ò", "ò" => "ò",
    "Ã\"" => "Ó", "ó" => "ó", "Ã\"" => "Ô", "ô" => "ô",
    "Õ" => "Õ", "õ" => "õ", "Ö" => "Ö", "Ø" => "Ø",
    "ø" => "ø", "Ù" => "Ù", "ù" => "ù", "Ú" => "Ú",
    "ú" => "ú", "Û" => "Û", "û" => "û", "Ãœ" => "Ü",
    "ü" => "ü", "Ý" => "Ý", "ý" => "ý", "Þ" => "Þ",
    "þ" => "þ", "ß" => "ß", "ö" => "ö"
   );
   function changeAccented($string) {
    global $replace;
    foreach($replace as $key => $val)
     $string = str_replace($key, $val, $string);
    return $string;
   }

   function removeAccents($string)
   {
      $accent  ="ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ";
      $noaccent="aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyyby";
      $string = strtr(trim($string),$accent,$noaccent);
      $string = changeAccented($string);
      return $string;
   }


But it doesn't work, signs and avs are well created, but special chars are not changed, I get " Cla©a¶.gif " for a caracters called " Cléö "...somebody have an idea on what could I do to correct this problem please ?...

Many thanks per advance,
arwenn
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Sun Jun 10, 2007 6:55 pm

Name Converting

Postby zanix » Thu Jun 28, 2007 9:43 am

Ah crap
The characters are utf-8 encoded
Try this
Code: Select all
    function removeAccents($string)
    {
        return 
utf8_decode(strtr($string,
            
"ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
            
"AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn"));
    } 

If utf8_decode doesn't work, use utf8_encode
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Re: Name Converting

Postby poetter » Sat Jul 07, 2007 8:10 am

Hi,

i think this should be:
Code: Select all
    function removeAccents($string)
    {
        return 
strtr(utf8_decode($string),
            
"ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
            
"AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn");
    }
 


Worked for me

maybe it has to be. but i think that does't make sense, as there are no more accents in the string.

Code: Select all
    function removeAccents($string)
    {
        return 
utf8_encode(strtr(utf8_decode($string),
            
"ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ",
            
"AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn"));
    }
 
Last edited by poetter on Sat Jul 07, 2007 8:12 am, edited 1 time in total.
User avatar
poetter
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 462
Joined: Sat Jun 30, 2007 9:41 pm
Location: Germany/Hamburg


Return to SigGen

Who is online

Users browsing this forum: No registered users and 1 guest

cron