Russian name with API

For discussion of the Poker Mavens server module and other administration topics
deisss
Posts: 31
Joined: Sun Aug 30, 2009 6:10 am

Russian name with API

Post 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);
?>
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: Russian name with API

Post 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.
deisss
Posts: 31
Joined: Sun Aug 30, 2009 6:10 am

Re: Russian name with API

Post 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);
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: Russian name with API

Post 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>
deisss
Posts: 31
Joined: Sun Aug 30, 2009 6:10 am

Re: Russian name with API

Post by deisss »

Ok I save .php file in UTF-8 and OK...
IN some browser not job seat picture.. what the bag???
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: Russian name with API

Post 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
deisss
Posts: 31
Joined: Sun Aug 30, 2009 6:10 am

Re: Russian name with API

Post 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
Kent Briggs
Site Admin
Posts: 5879
Joined: Wed Mar 19, 2008 8:47 pm

Re: Russian name with API

Post 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.
deisss
Posts: 31
Joined: Sun Aug 30, 2009 6:10 am

Re: Russian name with API

Post by deisss »

when to open such a table can sit under a dealer button
deisss
Posts: 31
Joined: Sun Aug 30, 2009 6:10 am

Re: Russian name with API

Post by deisss »

image
Attachments
players tab
players tab
untitled4.JPG (39.1 KiB) Viewed 9942 times
Post Reply