Location: PHPKode > scripts > AfterLogic WebMail Lite PHP > afterlogic-webmail-lite-php/webmail/common/utf8encode/windows-1251.php
<?php

	/**
	 * Original data taken from:
	 * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT
	 * @param string $string
	 * @return string
	 */
	function charset_encode_windows_1251($string)
	{
		$mapping = array(
					"\xD0\x82" => "\x80",
					"\xD0\x83" => "\x81",
					"\xE2\x80\x9A" => "\x82",
					"\xD1\x93" => "\x83",
					"\xE2\x80\x9E" => "\x84",
					"\xE2\x80\xA6" => "\x85",
					"\xE2\x80\xA0" => "\x86",
					"\xE2\x80\xA1" => "\x87",
					"\xE2\x82\xAC" => "\x88",
					"\xE2\x80\xB0" => "\x89",
					"\xD0\x89" => "\x8A",
					"\xE2\x80\xB9" => "\x8B",
					"\xD0\x8A" => "\x8C",
					"\xD0\x8C" => "\x8D",
					"\xD0\x8B" => "\x8E",
					"\xD0\x8F" => "\x8F",
					"\xD1\x92" => "\x90",
					"\xE2\x80\x98" => "\x91",
					"\xE2\x80\x99" => "\x92",
					"\xE2\x80\x9C" => "\x93",
					"\xE2\x80\x9D" => "\x94",
					"\xE2\x80\xA2" => "\x95",
					"\xE2\x80\x93" => "\x96",
					"\xE2\x80\x94" => "\x97",
					"\xE2\x84\xA2" => "\x99",
					"\xD1\x99" => "\x9A",
					"\xE2\x80\xBA" => "\x9B",
					"\xD1\x9A" => "\x9C",
					"\xD1\x9C" => "\x9D",
					"\xD1\x9B" => "\x9E",
					"\xD1\x9F" => "\x9F",
					"\xC2\xA0" => "\xA0",
					"\xD0\x8E" => "\xA1",
					"\xD1\x9E" => "\xA2",
					"\xD0\x88" => "\xA3",
					"\xC2\xA4" => "\xA4",
					"\xD2\x90" => "\xA5",
					"\xC2\xA6" => "\xA6",
					"\xC2\xA7" => "\xA7",
					"\xD0\x81" => "\xA8",
					"\xC2\xA9" => "\xA9",
					"\xD0\x84" => "\xAA",
					"\xC2\xAB" => "\xAB",
					"\xC2\xAC" => "\xAC",
					"\xC2\xAD" => "\xAD",
					"\xC2\xAE" => "\xAE",
					"\xD0\x87" => "\xAF",
					"\xC2\xB0" => "\xB0",
					"\xC2\xB1" => "\xB1",
					"\xD0\x86" => "\xB2",
					"\xD1\x96" => "\xB3",
					"\xD2\x91" => "\xB4",
					"\xC2\xB5" => "\xB5",
					"\xC2\xB6" => "\xB6",
					"\xC2\xB7" => "\xB7",
					"\xD1\x91" => "\xB8",
					"\xE2\x84\x96" => "\xB9",
					"\xD1\x94" => "\xBA",
					"\xC2\xBB" => "\xBB",
					"\xD1\x98" => "\xBC",
					"\xD0\x85" => "\xBD",
					"\xD1\x95" => "\xBE",
					"\xD1\x97" => "\xBF",
					"\xD0\x90" => "\xC0",
					"\xD0\x91" => "\xC1",
					"\xD0\x92" => "\xC2",
					"\xD0\x93" => "\xC3",
					"\xD0\x94" => "\xC4",
					"\xD0\x95" => "\xC5",
					"\xD0\x96" => "\xC6",
					"\xD0\x97" => "\xC7",
					"\xD0\x98" => "\xC8",
					"\xD0\x99" => "\xC9",
					"\xD0\x9A" => "\xCA",
					"\xD0\x9B" => "\xCB",
					"\xD0\x9C" => "\xCC",
					"\xD0\x9D" => "\xCD",
					"\xD0\x9E" => "\xCE",
					"\xD0\x9F" => "\xCF",
					"\xD0\xA0" => "\xD0",
					"\xD0\xA1" => "\xD1",
					"\xD0\xA2" => "\xD2",
					"\xD0\xA3" => "\xD3",
					"\xD0\xA4" => "\xD4",
					"\xD0\xA5" => "\xD5",
					"\xD0\xA6" => "\xD6",
					"\xD0\xA7" => "\xD7",
					"\xD0\xA8" => "\xD8",
					"\xD0\xA9" => "\xD9",
					"\xD0\xAA" => "\xDA",
					"\xD0\xAB" => "\xDB",
					"\xD0\xAC" => "\xDC",
					"\xD0\xAD" => "\xDD",
					"\xD0\xAE" => "\xDE",
					"\xD0\xAF" => "\xDF",
					"\xD0\xB0" => "\xE0",
					"\xD0\xB1" => "\xE1",
					"\xD0\xB2" => "\xE2",
					"\xD0\xB3" => "\xE3",
					"\xD0\xB4" => "\xE4",
					"\xD0\xB5" => "\xE5",
					"\xD0\xB6" => "\xE6",
					"\xD0\xB7" => "\xE7",
					"\xD0\xB8" => "\xE8",
					"\xD0\xB9" => "\xE9",
					"\xD0\xBA" => "\xEA",
					"\xD0\xBB" => "\xEB",
					"\xD0\xBC" => "\xEC",
					"\xD0\xBD" => "\xED",
					"\xD0\xBE" => "\xEE",
					"\xD0\xBF" => "\xEF",
					"\xD1\x80" => "\xF0",
					"\xD1\x81" => "\xF1",
					"\xD1\x82" => "\xF2",
					"\xD1\x83" => "\xF3",
					"\xD1\x84" => "\xF4",
					"\xD1\x85" => "\xF5",
					"\xD1\x86" => "\xF6",
					"\xD1\x87" => "\xF7",
					"\xD1\x88" => "\xF8",
					"\xD1\x89" => "\xF9",
					"\xD1\x8A" => "\xFA",
					"\xD1\x8B" => "\xFB",
					"\xD1\x8C" => "\xFC",
					"\xD1\x8D" => "\xFD",
					"\xD1\x8E" => "\xFE",
					"\xD1\x8F" => "\xFF");

		return str_replace(array_keys($mapping), array_values($mapping), $string);
	}
Return current item: AfterLogic WebMail Lite PHP