Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmccue/466552 to your computer and use it in GitHub Desktop.
Save rmccue/466552 to your computer and use it in GitHub Desktop.
Add special case for EUC-KR and mbstring
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment