[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/string/src/phputf8/utils/ -> bad.php (summary)

Tools for locating / replacing bad bytes in UTF-8 strings The Original Code is Mozilla Communicator client code. The Initial Developer of the Original Code is Netscape Communications Corporation. Portions created by the Initial Developer are Copyright (C) 1998 the Initial Developer. All Rights Reserved. Ported to PHP by Henri Sivonen (http://hsivonen.iki.fi) Slight modifications to fit with phputf8 library by Harry Fuecks (hfuecks gmail com)

File Size: 412 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 6 functions

  utf8_bad_find()
  utf8_bad_findall()
  utf8_bad_strip()
  utf8_bad_replace()
  utf8_bad_identify()
  utf8_bad_explain()

Functions
Functions that are not part of a class:

utf8_bad_find($str)   X-Ref
Locates the first bad byte in a UTF-8 string returning it's
byte index in the string
PCRE Pattern to locate bad bytes in a UTF-8 string
Comes from W3 FAQ: Multilingual Forms
Note: modified to include full ASCII range including control chars

param: string
return: mixed integer byte index or FALSE if no bad found

utf8_bad_findall($str)   X-Ref
Locates all bad bytes in a UTF-8 string and returns a list of their
byte index in the string
PCRE Pattern to locate bad bytes in a UTF-8 string
Comes from W3 FAQ: Multilingual Forms
Note: modified to include full ASCII range including control chars

param: string
return: mixed array of integers or FALSE if no bad found

utf8_bad_strip($str)   X-Ref
Strips out any bad bytes from a UTF-8 string and returns the rest
PCRE Pattern to locate bad bytes in a UTF-8 string
Comes from W3 FAQ: Multilingual Forms
Note: modified to include full ASCII range including control chars

param: string
return: string

utf8_bad_replace($str, $replace = '?')   X-Ref
Replace bad bytes with an alternative character - ASCII character
recommended is replacement char
PCRE Pattern to locate bad bytes in a UTF-8 string
Comes from W3 FAQ: Multilingual Forms
Note: modified to include full ASCII range including control chars

param: string to search
param: string to replace bad bytes with (defaults to '?') - use ASCII
return: string

utf8_bad_identify($str, &$i)   X-Ref
Reports on the type of bad byte found in a UTF-8 string. Returns a
status code on the first bad byte found

Joomla modification - As of PHP 7.4, curly brace access has been deprecated. As a result this function has been
modified to use square brace syntax
See https://github.com/php/php-src/commit/d574df63dc375f5fc9202ce5afde23f866b6450a
for additional references

author: <[email protected]>
param: string UTF-8 encoded string
return: mixed integer constant describing problem or FALSE if valid UTF-8

utf8_bad_explain($code)   X-Ref
Takes a return code from utf8_bad_identify() are returns a message
(in English) explaining what the problem is.

param: int return code from utf8_bad_identify
return: mixed string message or FALSE if return code unknown



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer