Page 1 of 2

Russian name with API

Posted: Tue Aug 02, 2011 2:42 am
by deisss
Hello KENT! why is created through the api user with a Russian name!
had to translate from English to Russian

Code: Select all

$str = preg_replace("/$viewer_id/","",$str);
$str = strip_tags($str);
$str= iconv('utf-8', 'windows-1251',$str);
function rus2translit($string) {
    $converter = array(
        'а' => 'a',   'б' => 'b',   'в' => 'v',
        'г' => 'g',   'д' => 'd',   'е' => 'e',
        'ё' => 'e',   'ж' => 'zh',  'з' => 'z',
        'и' => 'i',   'й' => 'y',   'к' => 'k',
        'л' => 'l',   'м' => 'm',   'н' => 'n',
        'о' => 'o',   'п' => 'p',   'р' => 'r',
        'с' => 's',   'т' => 't',   'у' => 'u',
        'ф' => 'f',   'х' => 'h',   'ц' => 'c',
        'ч' => 'ch',  'ш' => 'sh',  'щ' => 'sch',
        'ь' => '\'',  'ы' => 'y',   'ъ' => '\'',
        'э' => 'e',   'ю' => 'yu',  'я' => 'ya',
        
        'А' => 'A',   'Б' => 'B',   'В' => 'V',
        'Г' => 'G',   'Д' => 'D',   'Е' => 'E',
        'Ё' => 'E',   'Ж' => 'Zh',  'З' => 'Z',
        'И' => 'I',   'Й' => 'Y',   'К' => 'K',
        'Л' => 'L',   'М' => 'M',   'Н' => 'N',
        'О' => 'O',   'П' => 'P',   'Р' => 'R',
        'С' => 'S',   'Т' => 'T',   'У' => 'U',
        'Ф' => 'F',   'Х' => 'H',   'Ц' => 'C',
        'Ч' => 'Ch',  'Ш' => 'Sh',  'Щ' => 'Sch',
        'Ь' => '\'',  'Ы' => 'Y',   'Ъ' => '\'',
        'Э' => 'E',   'Ю' => 'Yu',  'Я' => 'Ya',

        'a' => 'a',   'b' => 'b',   'v' => 'v',
        'g' => 'g',   'd' => 'd',   'e' => 'e',
        'e' => 'e',   'j' => 'j',  'z' => 'z',
        'і' => 'i',   'y' => 'y',   'k' => 'k',
        'l' => 'l',   'm' => 'm',   'n' => 'n',
        'o' => 'o',   'p' => 'p',   'r' => 'r',
        's' => 's',   't' => 't',   'u' => 'u',
        'f' => 'f',   'h' => 'h',   'c' => 'c',
        'w' => 'w',  'q' => 'q',  'x' => 'x',
        
        'A' => 'A',   'B' => 'B',   'V' => 'V',
        'G' => 'G',   'D' => 'D',   'E' => 'E',
        'E' => 'E',   'J' => 'J',  
        'І' => 'I',   'Y' => 'Y',   'K' => 'K',
        'L' => 'L',   'M' => 'M',   'N' => 'N',
        'O' => 'O',   'P' => 'P',   'R' => 'R',
        'S' => 'S',   'T' => 'T',   'U' => 'U',
        'F' => 'F',   'H' => 'H',   'C' => 'C',
        'W' => 'W',  'Q' => 'Q',  'X' => 'X',
    );
    return strtr($string, $converter);
}



$params = "Password=$pw&Command=AccountsAdd" .
                "&Player=id" . urlencode(FFFFFFFFFF) .
                "&Title=" . "FFFFFFFFFF" .
                "&Level=" . "FFFFFFFF" .
                "&PW=" . "FFFFFFFFFFFFF" .
[b]"&RealName=" . str2url($str) .[/b]                "&Location="  . "russia" .
                "&Email=" . "[email protected]" .
                "&Custom=" . "" .
                "&Avatar=" . "1" .
		"&Gender=" . urlencode(Male);
$api = Poker_API($url,$params,true);
?>

Re: Russian name with API

Posted: Tue Aug 02, 2011 9:36 am
by Kent Briggs
deisss wrote:Hello KENT! why is created through the api user with a Russian name!
had to translate from English to Russian
Not sure what you are asking. Are you having trouble creating new accounts with a Russian name using the API? Poker Mavens uses Unicode text encoding so make sure your API code is not using Windows page-based encoding.

Re: Russian name with API

Posted: Fri Aug 05, 2011 8:30 am
by deisss
Are you having trouble creating new accounts with a Russian name using the API?
YEs, I had to translate each letter into English, using PHP.
how can I do to write in Russian?

Code: Select all

$params = "Password=$pw&Command=AccountsAdd" .
                "&Player=id" . urlencode(RUSSAIN LANG) .
                "&Title=" . "RUSSAIN LANG" .
                "&Level=" . "FFFFFFFF" .
                "&PW=" . "RUSSAIN LANG" .
[b]"&RealName=" . РУССКИЙ                "&Location="  . "russia" .
                "&Email=" . "[email protected]" .
                "&Custom=" . "" .
                "&Avatar=" . "1" .
      "&Gender=" . urlencode(Male);
$api = Poker_API($url,$params,true);

Re: Russian name with API

Posted: Fri Aug 05, 2011 9:51 am
by Kent Briggs
deisss wrote:Are you having trouble creating new accounts with a Russian name using the API?
YEs, I had to translate each letter into English, using PHP.
how can I do to write in Russian?
Are you getting an error message?

It's working fine for me using the test code below where I used Google Translate to make the Russian word for "banana" as a player name:

Code: Select all

<?php
  include "API.php";
  $Player = "банан";
  $RealName = "Test";
  $Gender = "Male";
  $Location = "Test";
  $Password = "xxxxxx";
  $Email = "[email protected]";
  $Avatar = "1";
  $params = "Password=$pw&Command=AccountsAdd" .
            "&Player=" .   urlencode($Player) .
            "&RealName=" . urlencode($RealName) .
            "&PW=" .       urlencode($Password) .
            "&Location=" . urlencode($Location) .
            "&Email=" .    urlencode($Email) .
            "&Avatar=" .   urlencode($Avatar) .
            "&Gender=" .   urlencode($Gender) .
            "&Chat=" .     "Yes" .
            "&Note=" .     urlencode("Account created via API");
  $api = Poker_API($url,$params,true);
  if ($api["Result"] == "Ok") echo "Account successfully created for $Player";
  else echo "Error: " . $api["Error"];
?>
The trick is to make sure your source file is encoded in UTF-8. When I saved my .php file, I specifically selected UTF-8 in my text editor so that it put the proper UTF-8 BOM at the beginning of the file. If you are using a web form to collect the information, make sure you have the following line in the <head> section:

Code: Select all

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

Re: Russian name with API

Posted: Sat Aug 06, 2011 10:05 am
by deisss
Ok I save .php file in UTF-8 and OK...
IN some browser not job seat picture.. what the bag???

Re: Russian name with API

Posted: Sat Aug 06, 2011 11:30 am
by Kent Briggs
deisss wrote:Ok I save .php file in UTF-8 and OK...
IN some browser not job seat picture.. what the bag???
Which browser? If it's Opera, see item 12 in the FAQ:

http://www.briggsoft.com/pmfaq.htm

Re: Russian name with API

Posted: Sun Aug 07, 2011 1:01 pm
by deisss
OK thx KENT...
And by the way Kent is not good that the Avatar = C: /, ie, takes a drive
do please fix as soon as possible so that you can take with AVATAR http://MYSITE.com/myavatar.gif.
thank you

Re: Russian name with API

Posted: Sun Aug 07, 2011 1:19 pm
by Kent Briggs
deisss wrote:OK thx KENT...
And by the way Kent is not good that the Avatar = C: /, ie, takes a drive
do please fix as soon as possible so that you can take with AVATAR http://MYSITE.com/myavatar.gif.
thank you
The image needs to be in the local file system for maximum performance and reliability. You wouldn't want missing avatars just because someone's web site went down.

Re: Russian name with API

Posted: Mon Aug 08, 2011 5:26 am
by deisss
when to open such a table can sit under a dealer button

Re: Russian name with API

Posted: Mon Aug 08, 2011 5:28 am
by deisss
image