Beispiel #1
0
<?php

namespace Vensko;

Utf8::$asciiRange = array_fill_keys(range(0, 127), true);
class Utf8
{
    const UTF16BE_BOM = "þÿ";
    const UTF16LE_BOM = "ÿþ";
    const UTF8_BOM = "";
    const UTF7_BOM = "+/v";
    const UTF32BE_BOM = "þÿ";
    const UTF32LE_BOM = "ÿþ";
    const ASCII = 'ASCII';
    const UTF8 = 'UTF-8';
    const UTF7 = 'UTF-7';
    const UTF16BE = 'UTF-16BE';
    const UTF16LE = 'UTF-16LE';
    const UTF32BE = 'UTF-32BE';
    const UTF32LE = 'UTF-32LE';
    const CP1250 = 'Windows-1250';
    const CP1251 = 'Windows-1251';
    const CP1252 = 'Windows-1252';
    public static $asciiRange = [];
    /**
     * Ensures that a string is UTF-8 encoded
     *
     * @param string|$str
     * @param string|null $fromEncoding
     * @param bool $force
     * @return string