ord($adjustment[count($adjustment)-1])) { $adjusted = $codepoint - count($adjustment); } else if ($codepoint > ord($adjustment[0])) { for ($i=1; $i < count($adjustment); $i++) { if ($codepoint < ord($adjustment[$i])) { break; } } $adjusted = $codepoint - $i; } else { $adjusted = $codepoint; } // substract number of non-printable characters and return return $adjusted - ord(' '); } private function reverseForPlain($adjusted) { $adjustment = self::getAdjustments(); // reverse adjustment for non-printable characters $adjusted += ord(' '); if ($adjusted + count($adjustment) > ord($adjustment[count($adjustment)-1])) { $adjusted += count($adjustment); } else if ($adjusted > ord($adjustment[0])) { for ($i=1; $i < count($adjustment); $i++) { if ($adjusted + $i < ord($adjustment[$i])) { break; } } $adjusted += $i; } return $adjusted; } private function getAdjustments() { if (empty(self::$adjustments)) { self::$adjustments = str_split(self::$plain.self::$pre_indicator.self::$post_indicator); sort(self::$adjustments); } return self::$adjustments; } }