Add special case for EUC-KR and mbstring

  • Download Gist
0001-Add-special-case-for-EUC-KR-and-mbstring.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
From af1d5babcd29cfa88e2d9825afa73eb242b12133 Mon Sep 17 00:00:00 2001
From: Ryan McCue <ryanmccue@cubegames.net>
Date: Wed, 7 Jul 2010 20:49:44 +1000
Subject: [PATCH] Add special case for EUC-KR and mbstring
 
---
simplepie.class.php | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
 
diff --git a/simplepie.class.php b/simplepie.class.php
index 2aeb1ff..10d0f5f 100644
--- a/simplepie.class.php
+++ b/simplepie.class.php
@@ -9001,9 +9001,19 @@ class SimplePie_Misc
return SimplePie_Misc::windows_1252_to_utf8($data);
}
// This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported).
- elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input)))
- {
- return $return;
+ elseif (function_exists('mb_convert_encoding')) {
+ if($input === 'windows-949')
+ {
+ $input = 'EUC-KR';
+ }
+ if($output === 'windows-949')
+ {
+ $input = 'EUC-KR';
+ }
+ if (@mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input)))
+ {
+ return $return;
+ }
}
// This is last, as behaviour of this varies with OS userland and PHP version
elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data)))
--
1.6.5.1.1367.gcd48

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.