*/
class Fallback {
- /**
- * @param string $from
- * @param string $to
- * @param string $string
- * @return string
- */
- public static function iconv( $from, $to, $string ) {
- if ( substr( $to, -8 ) == '//IGNORE' ) {
- $to = substr( $to, 0, strlen( $to ) - 8 );
- }
- if ( strcasecmp( $from, $to ) == 0 ) {
- return $string;
- }
- if ( strcasecmp( $from, 'utf-8' ) == 0 ) {
- return utf8_decode( $string );
- }
- if ( strcasecmp( $to, 'utf-8' ) == 0 ) {
- return utf8_encode( $string );
- }
- return $string;
- }
-
/**
* Fallback implementation for mb_substr, hardcoded to UTF-8.
* Attempts to be at least _moderately_ efficient; best optimized