[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Utf8/ -> Conversion.php (summary)

(no description)

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

Defines 1 class

Conversion:: (6 methods):
  toHtml()
  fromHtml()
  decodeAnyEntity()
  decodeNumericEntity()
  toUtf16be()
  fromUtf16be()


Class: Conversion  - X-Ref

Methods to convert from and to UTF-8 strings

toHtml($str, $all = false)   X-Ref
Encodes UTF-8 characters to HTML entities

link: http://php.net/manual/en/function.utf8-decode.php
author: Tom N Harris <tnharris@whoopdedo.org>
author: <vpribish at shopping dot com>
param: string $str
param: bool $all Encode non-utf8 char to HTML as well
return: string

fromHtml($str, $entities = false)   X-Ref
Decodes HTML entities to UTF-8 characters

Convert any &#..; entity to a codepoint,
The entities flag defaults to only decoding numeric entities.
Pass HTML_ENTITIES and named entities, including &amp; &lt; etc.
are handled as well. Avoids the problem that would occur if you
had to decode "&amp;#38;&#38;amp;#38;"

unhtmlspecialchars(\dokuwiki\Utf8\Conversion::fromHtml($s)) -> "&#38;&#38;"
\dokuwiki\Utf8\Conversion::fromHtml(unhtmlspecialchars($s)) -> "&&amp#38;"
what it should be                   -> "&#38;&amp#38;"

author: Tom N Harris <tnharris@whoopdedo.org>
param: string $str UTF-8 encoded string
param: boolean $entities decode name entities in addtition to numeric ones
return: string  UTF-8 encoded string with numeric (and named) entities replaced.

decodeAnyEntity($ent)   X-Ref
Decodes any HTML entity to it's correct UTF-8 char equivalent

param: string $ent An entity
return: string

decodeNumericEntity($ent)   X-Ref
Decodes numeric HTML entities to their correct UTF-8 characters

param: $ent string A numeric entity
return: string|false

toUtf16be($str, $bom = false)   X-Ref
UTF-8 to UTF-16BE conversion.

Maybe really UCS-2 without mb_string due to utf8_to_unicode limits

param: string $str
param: bool $bom
return: string

fromUtf16be($str)   X-Ref
UTF-8 to UTF-16BE conversion.

Maybe really UCS-2 without mb_string due to utf8_to_unicode limits

param: string $str
return: false|string