Latin to specialchar table: de- and encrypt stylized names

Moderators: Xymph, NADEO

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

Latin to specialchar table: de- and encrypt stylized names

Post by askuri » 30 Mar 2016, 16:22

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 :)
ManiaCDN.net: the new free hoster for your custom content

Specs: i5 6600K; MSI Z170A Gaming Pro; 2x8GB Crucial DDR4 2133MHz; Intel HD Graphics 530; Windows 10 Home 64 Bit

User avatar
askuri
Posts: 281
Joined: 18 Oct 2011, 15:01
Location: Germany

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

Post by askuri » 30 May 2017, 21:55

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;
?>
ManiaCDN.net: the new free hoster for your custom content

Specs: i5 6600K; MSI Z170A Gaming Pro; 2x8GB Crucial DDR4 2133MHz; Intel HD Graphics 530; Windows 10 Home 64 Bit

Post Reply

Return to “General Tools”

Who is online

Users browsing this forum: No registered users and 1 guest