| @@ -220,12 +220,32 @@ | ||
| 220 | 220 | 0, |
| 221 | 221 | ); |
| 222 | 222 | } |
| 223 | 223 | break; |
| 224 | + case 'string': | |
| 225 | + $data[ $i ] = $this->toUTF8( $data[ $i ] ); | |
| 226 | + break; | |
| 224 | 227 | } |
| 225 | 228 | } |
| 226 | 229 | |
| 227 | 230 | // error_log(print_r($data,true)); |
| 228 | 231 | return $data; |
| 232 | + } | |
| 233 | + | |
| 234 | + | |
| 235 | + /** | |
| 236 | + * Converts values to UTF8, if required. | |
| 237 | + * | |
| 238 | + * @access protected | |
| 239 | + * | |
| 240 | + * @param string $datum The data to convert. | |
| 241 | + * | |
| 242 | + * @return string The converted data. | |
| 243 | + */ | |
| 244 | + protected final function toUTF8( $datum ) { | |
| 245 | + if ( ! function_exists( 'mb_detect_encoding' ) || mb_detect_encoding( $datum ) !== 'ASCII' ) { | |
| 246 | + $datum = \ForceUTF8\Encoding::toUTF8( $datum ); | |
| 247 | + } | |
| 248 | + return $datum; | |
| 229 | 249 | } |
| 230 | 250 | |
| 231 | 251 | } |