Latin to specialchar table: de- and encrypt stylized names

Moderators: Xymph, NADEO

Post Reply
User avatar
askuri
Posts: 285
Joined: 18 Oct 2011, 15:01
Location: Germany

Latin to specialchar table: de- and encrypt stylized names

Post by askuri »

I collected all specialchars aining a latin one in a table. This is useful in to ways:
  • Players can more easily "encrypt" their name, because they do not have to search for fitting specialchars
  • Programmers can implement a function to their software, which makes it possible to search for encrypted name. At the moment no one ever finds a map by a search function, if it mainly consists of specialchars. Using str_replace (which supports arrays), you can decrypt it into latin chars. E.g. my nickname "λsκμяι" which can't be found easily would turn into "askuri", which is what the seeker typed in. Some ideas for realising the backend: use strtolower(), str_replace(), levenshtein(). Right now I do not have a ready to use code snippet or library.
The table is in CSV accessable on http://maniacdn.net/askuri/latin-unicode/table.csv. Feel free to use this for continuus updating, it's a static link :)
User avatar
askuri
Posts: 285
Joined: 18 Oct 2011, 15:01
Location: Germany

Re: Latin to specialchar table: de- and encrypt stylized names

Post by askuri »

Example, how to use it in PHP (why didn't I post this before?):

Code: Select all

<?php
// read the table (original is with ; separator, this function expects ,)
$array = array_map('str_getcsv', file('table.csv')); // reads csv into php array

$subject = "ÐĘЯЯ@"; // example input
foreach ($array as $row) { // do the same for every latin char
	$latin = array_shift($row); // first one is latin, following are any char we want to replace
	$subject = str_ireplace($row, $latin, $subject); // replace them case-insensitively
}

echo $subject;
?>
Post Reply

Return to “General Tools”

Who is online

Users browsing this forum: No registered users and 1 guest