[//]: # (AUTO-GENERATED BY "PHP README Helper": base file -> docs/base.md)
[![Build Status](https://travis-ci.com/voku/portable-utf8.svg?branch=master)](https://travis-ci.com/voku/portable-utf8)
[![Build status](https://ci.appveyor.com/api/projects/status/gnejjnk7qplr7f5t/branch/master?svg=true)](https://ci.appveyor.com/project/voku/portable-utf8/branch/master)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fvoku%2Fportable-utf8.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fvoku%2Fportable-utf8?ref=badge_shield)
[![Coverage Status](https://coveralls.io/repos/voku/portable-utf8/badge.svg?branch=master&service=github)](https://coveralls.io/github/voku/portable-utf8?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/997c9bb10d1c4791967bdf2e42013e8e)](https://www.codacy.com/app/voku/portable-utf8)
[![Latest Stable Version](https://poser.pugx.org/voku/portable-utf8/v/stable)](https://packagist.org/packages/voku/portable-utf8)
[![Total Downloads](https://poser.pugx.org/voku/portable-utf8/downloads)](https://packagist.org/packages/voku/portable-utf8)
[![License](https://poser.pugx.org/voku/portable-utf8/license)](https://packagist.org/packages/voku/portable-utf8)
[![Donate to this project using PayPal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/moelleken)
[![Donate to this project using Patreon](https://img.shields.io/badge/patreon-donate-yellow.svg)](https://www.patreon.com/voku)
# 🉑 Portable UTF-8
## Description
It is written in PHP (PHP 7+) and can work without "mbstring", "iconv" or any other extra encoding php-extension on your server.
The benefit of Portable UTF-8 is that it is easy to use, easy to bundle. This library will also
auto-detect your server environment and will use the installed php-extensions if they are available,
so you will have the best possible performance.
As a fallback we will use Symfony Polyfills, if needed. (https://github.com/symfony/polyfill)
The project based on ...
+ Hamid Sarfraz's work - [portable-utf8](http://pageconfig.com/attachments/portable-utf8.php)
+ Nicolas Grekas's work - [tchwork/utf8](https://github.com/tchwork/utf8)
+ Behat's work - [Behat/Transliterator](https://github.com/Behat/Transliterator)
+ Sebastián Grignoli's work - [neitanod/forceutf8](https://github.com/neitanod/forceutf8)
+ Ivan Enderlin's work - [hoaproject/Ustring](https://github.com/hoaproject/Ustring)
+ and many cherry-picks from "GitHub"-gists and "Stack Overflow"-snippets ...
## Demo
Here you can test some basic functions from this library and you can compare some results with the native php function results.
+ [encoder.suckup.de](https://encoder.suckup.de/)
## Index
* [Alternative](#alternative)
* [Install](#install-portable-utf-8-via-composer-require)
* [Why Portable UTF-8?](#why-portable-utf-8)
* [Requirements and Recommendations](#requirements-and-recommendations)
* [Warning](#warning)
* [Usage](#usage)
* [Class methods](#class-methods)
* [Unit Test](#unit-test)
* [License and Copyright](#license-and-copyright)
## Alternative
If you like a more Object Oriented Way to edit strings, then you can take a look at [voku/Stringy](https://github.com/voku/Stringy), it's a fork of "danielstjules/Stringy" but it used the "Portable UTF-8"-Class and some extra methods.
```php
// Standard library
strtoupper('fòôbàř'); // 'FòôBàř'
strlen('fòôbàř'); // 10
// mbstring
// WARNING: if you don't use a polyfill like "Portable UTF-8", you need to install the php-extension "mbstring" on your server
mb_strtoupper('fòôbàř'); // 'FÒÔBÀŘ'
mb_strlen('fòôbàř'); // '6'
// Portable UTF-8
use voku\helper\UTF8;
UTF8::strtoupper('fòôbàř'); // 'FÒÔBÀŘ'
UTF8::strlen('fòôbàř'); // '6'
// voku/Stringy
use Stringy\Stringy as S;
$stringy = S::create('fòôbàř');
$stringy->toUpperCase(); // 'FÒÔBÀŘ'
$stringy->length(); // '6'
```
## Install "Portable UTF-8" via "composer require"
```shell
composer require voku/portable-utf8
```
If your project do not need some of the Symfony polyfills please use the `replace` section of your `composer.json`.
This removes any overhead from these polyfills as they are no longer part of your project. e.g.:
```json
{
"replace": {
"symfony/polyfill-php72": "1.99",
"symfony/polyfill-iconv": "1.99",
"symfony/polyfill-intl-grapheme": "1.99",
"symfony/polyfill-intl-normalizer": "1.99",
"symfony/polyfill-mbstring": "1.99"
}
}
```
## Why Portable UTF-8?[]()
PHP 5 and earlier versions have no native Unicode support. To bridge the gap, there exist several extensions like "mbstring", "iconv" and "intl".
The problem with "mbstring" and others is that most of the time you cannot ensure presence of a specific one on a server. If you rely on one of these, your application is no more portable. This problem gets even severe for open source applications that have to run on different servers with different configurations. Considering these, I decided to write a library:
## Requirements and Recommendations
* No extensions are required to run this library. Portable UTF-8 only needs PCRE library that is available by default since PHP 4.2.0 and cannot be disabled since PHP 5.3.0. "\u" modifier support in PCRE for UTF-8 handling is not a must.
* PHP 5.3 is the minimum requirement, and all later versions are fine with Portable UTF-8.
* PHP 7.0 is the minimum requirement since version 4.0 of Portable UTF-8, otherwise composer will install an older version
* PHP 8.0 support is also available and will adapt the behaviours of the native functions.
* To speed up string handling, it is recommended that you have "mbstring" or "iconv" available on your server, as well as the latest version of PCRE library
* Although Portable UTF-8 is easy to use; moving from native API to Portable UTF-8 may not be straight-forward for everyone. It is highly recommended that you do not update your scripts to include Portable UTF-8 or replace or change anything before you first know the reason and consequences. Most of the time, some native function may be all what you need.
* There is also a shim for "mbstring", "iconv" and "intl", so you can use it also on shared webspace.
## Info
Since version 5.4.26 this library will NOT force "UTF-8" by "bootstrap.php" anymore.
If you need to enable this behavior you can define "PORTABLE_UTF8__ENABLE_AUTO_FILTER", before requiring the autoloader.
```php
define('PORTABLE_UTF8__ENABLE_AUTO_FILTER', 1);
```
Before version 5.4.26 this behavior was enabled by default and you could disable it via "PORTABLE_UTF8__DISABLE_AUTO_FILTER",
but the code had potential security vulnerabilities via injecting code while redirecting via ```header('Location ...```.
This is the reason I decided to add this BC in a bug fix release, so that everybody using the current version will receive the security-fix.
## Usage
Example 1: UTF8::cleanup()
```php
echo UTF8::cleanup('�Düsseldorf�');
// will output:
// Düsseldorf
```
Example 2: UTF8::strlen()
```php
$string = 'string <strong>with utf-8 chars åèä</strong> - doo-bee doo-bee dooh';
echo strlen($string) . "\n<br />";
echo UTF8::strlen($string) . "\n<br />";
// will output:
// 70
// 67
$string_test1 = strip_tags($string);
$string_test2 = UTF8::strip_tags($string);
echo strlen($string_test1) . "\n<br />";
echo UTF8::strlen($string_test2) . "\n<br />";
// will output:
// 53
// 50
```
Example 3: UTF8::fix_utf8()
```php
echo UTF8::fix_utf8('Düsseldorf');
echo UTF8::fix_utf8('ä');
// will output:
// Düsseldorf
// ä
```
# Portable UTF-8 | API
The API from the "UTF8"-Class is written as small static methods that will match the default PHP-API.
## Class methods
<p id="voku-php-readme-class-methods"></p><table><tr><td><a href="#accessstring-str-int-pos-string-encoding-string">access</a>
</td><td><
没有合适的资源?快使用搜索试试~ 我知道了~
PESCMS DOC开源管理文档管理系统 v2.0.5兼容PC端和移动端
共2000个文件
json:1168个
php:989个
js:162个
需积分: 5 3 下载量 141 浏览量
2023-03-21
14:30:25
上传
评论
收藏 11.55MB RAR 举报
温馨提示
PESCMS DOC是一款基于PESCMS2.5开发的文档系统:管理文档原来可以做到如此便捷! 本程序基于GPLV2协议进行开源发布,个人/商业用户在不进行闭源销售情况下,没有任何使用限制! 日常工作经常需要涉及到文档的编写。文档如何保存成为一个让人头疼的事情。而文档如何便于查阅又是一个让人头疼的事情。 为此,PESCMS官方根据自身实际的业务需求,开发一套简单,便捷,易容的文档管理系统。 从今天起,扔掉还在IM上互相传递文档的陋习吧!从今天,文档不用在提交到版本库保存了!从今天起,查阅文档只需要一个浏览器终端!(兼容PC端和移动端) 环境要求: PHP:5.4及以上 Mysql:5.1及以上(推荐5.5及以上版本) 更新日志: 1、集成富文本编辑和Markdown编辑器 2、权限管理、阅读权限 3、无限层级的文档 4、通过接口编写PESCMS DOC文档 5、根据API请求,编写或生成文档
资源推荐
资源详情
资源评论
收起资源包目录
PESCMS DOC开源管理文档管理系统 v2.0.5兼容PC端和移动端 (2000个子文件)
random_compat.phar.pubkey.asc 488B
compile 371B
amazeui.css 327KB
amazeui.flat.css 325KB
amazeui.min.css 252KB
amazeui.flat.min.css 250KB
ueditor.css 42KB
ueditor.min.css 34KB
Vditor.css 34KB
Vditor.min.css 34KB
katex.min.css 22KB
video-js.css 21KB
image.css 18KB
video.css 15KB
attachment.css 14KB
video-js.min.css 11KB
ui-dialog.css 11KB
main.css 10KB
ui-dialog.min.css 8KB
tango.css 8KB
main.min.css 7KB
colorful.css 7KB
ant-design.css 7KB
pastie.css 7KB
solarized-light.css 7KB
github.css 7KB
murphy.css 7KB
shCoreDefault.css 7KB
friendly.css 7KB
rainbow_dash.css 7KB
emacs.css 7KB
manni.css 7KB
monokailight.css 7KB
native.css 7KB
pygments.css 7KB
lovelace.css 7KB
trac.css 6KB
perldoc.css 6KB
autumn.css 6KB
xcode.css 6KB
amazeui.datetimepicker.css 6KB
abap.css 6KB
arduino.css 6KB
solarized-dark256.css 6KB
paraiso-light.css 6KB
paraiso-dark.css 6KB
borland.css 6KB
fruity.css 6KB
dracula.css 6KB
solarized-dark.css 6KB
bw.css 6KB
vim.css 6KB
swapoff.css 6KB
monokai.css 5KB
algol.css 5KB
create.css 5KB
rrt.css 5KB
ant-design.css 5KB
algol_nu.css 5KB
create.min.css 4KB
vs.css 4KB
igor.css 4KB
scrawl.css 4KB
codemirror.css 3KB
wechat.css 3KB
dark.css 3KB
charts.css 3KB
background.css 2KB
emotion.css 2KB
dialogbase.css 2KB
music.css 2KB
webuploader.css 2KB
edittable.css 1KB
webuploader.min.css 1KB
template.css 1KB
webuploader.css 515B
help.css 389B
iframe.css 41B
light.css 0B
.php_cs.dist 1KB
phpunit.xml.dist 984B
phpunit.xml.dist 890B
.editorconfig 337B
fontawesome-webfont.eot 69KB
vjs.eot 3KB
UEditorSnapscreen.exe 508KB
wface.gif 49KB
jxface2.gif 40KB
yface.gif 28KB
bface.gif 27KB
icons.gif 20KB
file-icons.gif 20KB
file-icons.gif 20KB
tface.gif 19KB
fface.gif 18KB
cface.gif 8KB
icons-all.gif 4KB
videologo.gif 2KB
cancelbutton.gif 1KB
button-bg.gif 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
乱世英熊
- 粉丝: 0
- 资源: 20
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 井下甲烷气体报警器研发(工程教育课程项目报告)
- 流量预测.rar流量预测.rar流量预测.rar流量预测.rar
- java11 安装包和免安装包.zip
- Sigrity-Simulation Options Quick Help.rar
- CRC校验日常学习笔记
- Sigrity-Celsius Thermal Solver User Guide.rar
- Sigrity-Celsius Thermal Solver Tutorial.rar
- GoFullPage full page catpure版本8.3
- Sigrity-TCL Scripting Reference.rar
- Sigrity-SpeedEditor Tutorial.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功