utf8_uri_encode [ WordPress Function ]
utf8_uri_encode ( $utf8_string, $length = 0 )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Encode the Unicode values to be used in the URI.
Source
<?php
function utf8_uri_encode( $utf8_string, $length = 0 ) {
$unicode = '';
$values = array();
$num_octets = 1;
$unicode_length = 0;
$string_length = strlen( $utf8_string );
for ($i = 0; $i < $string_length; $i++ ) {
$value = ord( $utf8_string[ $i ] );
if ( $value < 128 ) {
if ( $length && ( $unicode_length >= $length ) )
break;
$unicode .= chr($value);
$unicode_length++;
} else {
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
$values[] = $value;
if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
break;
if ( count( $values ) == $num_octets ) {
if ($num_octets == 3) {
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
$unicode_length += 9;
} else {
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
$unicode_length += 6;
}
$values = array();
$num_octets = 1;
}
}
}
return $unicode;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/utf8 uri encode « WordPress Codex
Function Reference/utf8 uri encode ... Usage. <?php utf8_uri_encode( $ utf8_string, $length ) ?> ... utf8_uri_encode() is located in wp-includes/formatting. php.
codex.wordpress.org - WordPress › Support » Tags — utf8_uri_encode
Forums. Username or Email Address Password (forgot?) Register · WordPress › Support » utf8_uri_encode. Tag: utf8_uri_encode Add New » ...
wordpress.org - utf8_uri_encode() WordPress function reference, arguments and ...
Encode the Unicode values to be used in the URI. Signature. utf8_uri_encode( $ utf8_string, $length = 0 ). utf8_string: (string); length: (int) Max length of the ...
queryposts.com - utf8_uri_encode (WordPress Function) - WPSeek.com
WordPress lookup for utf8_uri_encode, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com