Skip to content

Instantly share code, notes, and snippets.

@Max-Might
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Max-Might/9639797 to your computer and use it in GitHub Desktop.
Save Max-Might/9639797 to your computer and use it in GitHub Desktop.
Code Page 866 to CP1251
<?php
function cp866_to_cp1251($input)
{
$buffer = "";
for($i=0; $i<strlen($input); $i++)
{
if((ord($input[$i]) >= 128) && (ord($input[$i]) <= 191))
{
$buffer .= chr(ord($input[$i]) + 64);
} else {
$buffer .= $input[$i];
}
}
return $buffer;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment