[//]: # (AUTO-GENERATED BY "PHP README Helper": base file -> docs/base.md)
[![Build Status](https://travis-ci.org/voku/portable-utf8.svg?branch=master)](https://travis-ci.org/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
* 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>
没有合适的资源?快使用搜索试试~ 我知道了~
在线聊天室系统+自适应PC+WAP端源码可发语音图片
共1835个文件
php:623个
svg:532个
jpeg:138个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 120 浏览量
2022-06-20
21:51:15
上传
评论
收藏 26.15MB ZIP 举报
温馨提示
在线聊天室系统+自适应PC+WAP端源码可发语音图片 PS 本源码提供给大家学习研究借鉴美工之用,请勿用于商业和非法用途,无任何技术支持! 运行环境 PHP+MYSQL
资源推荐
资源详情
资源评论
收起资源包目录
在线聊天室系统+自适应PC+WAP端源码可发语音图片 (1835个子文件)
CHANGELOG 62KB
COMMITMENT 2KB
styles.rtl.min.css 224KB
styles.css 221KB
styles.ltr.min.css 165KB
index.css 77KB
animate.min.css 70KB
all.min.css 55KB
all.min.css 55KB
frontend.css 49KB
flag-icon.min.css 33KB
emojionearea.min.css 24KB
select2.min.css 21KB
summernote.min.css 19KB
admin.css 18KB
default-skin.css 11KB
theme-dark.css 11KB
dropzone.min.css 10KB
toastr.min.css 7KB
toastr.min.css 7KB
dataTables.bootstrap4.min.css 5KB
dataTables.bootstrap4.min.css 5KB
theme-custom.css 5KB
photoswipe.css 4KB
theme-dark.css 3KB
theme-default.css 0B
data.csv 140B
.php_cs.dist 799B
.editorconfig 224B
fa-solid-900.eot 188KB
fa-solid-900.eot 188KB
fa-brands-400.eot 127KB
fa-brands-400.eot 127KB
fa-regular-400.eot 34KB
fa-regular-400.eot 34KB
summernote.eot 12KB
loading-video.gif 21KB
loading.gif 9KB
preloader.gif 866B
.gitignore 70B
.gitignore 17B
.htaccess 1KB
.htaccess 1KB
settings.html 49KB
chat_room.html 37KB
color.html 17KB
base.index.html 16KB
chat_room_update.html 14KB
base.html 13KB
login.html 12KB
chatpage.html 11KB
user_view.html 10KB
general.html 9KB
image.html 9KB
chatroom_update.html 8KB
register.html 8KB
index.html 8KB
base.html 7KB
join_chatroom.html 7KB
user_add.html 7KB
password_reset.html 6KB
profile_modal.html 6KB
advertisements.html 6KB
user_list.html 5KB
registration_settings.html 5KB
chat_room_loop_small.html 5KB
contact.html 5KB
chat_room_loop_large.html 5KB
user_chats.html 5KB
homepage.html 5KB
chatroom_list.html 5KB
index.html 4KB
chatroom_users.html 4KB
reset_password.html 4KB
forgot_password.html 3KB
contact.html 3KB
guest_list.html 3KB
languages.html 3KB
base.min.html 3KB
email.html 3KB
contact.html 3KB
policy.html 3KB
chat_room_list_modal.html 2KB
language_view.html 2KB
timing.html 2KB
profanity.html 2KB
language_translation.html 2KB
about.html 2KB
gif.html 1KB
header.html 1024B
footer.html 1008B
rebuild_translate.html 829B
terms.html 625B
privacy.html 609B
about.html 591B
sample.html 336B
602fa09b657e42.33155296_qlgjfehinmpok.jpeg 2.75MB
6095e101464b81.78621224_nqepoklmfgijh.jpeg 999KB
1611194492828.1618057398.jpeg 951KB
6093cc5eb5e7c1.04780764_kofplmjighnqe.jpeg 523KB
共 1835 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19
资源评论
送涂图
- 粉丝: 95
- 资源: 163
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 堆排序(Heap Sort)是一种基于比较的排序算法
- ebatis 是一个简单方便上手的声明式 Elasticsearch ORM 框架
- 威纶通触摸屏编程软件Easy builder pro V6.09.02安装包(2024.06).txt
- ES查询客户端,elasticsearch可视化工具 elasticsearch查询客户端
- html css js网页制作实例 dldtdd实现列表功能
- 用python制作的tts语音小工具
- 三菱PLC编程参考手册
- 吃豆人代码源码全套.cpp
- 快速了解学习「编译原理」都需要掌握哪些基础知识.pdf
- Verilog示例代码,以SMIC 12nm工艺库为例给出Tessent TCL脚本示例
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功