Created
October 14, 2012 10:34
-
-
Save sasezaki/3888205 to your computer and use it in GitHub Desktop.
For unexpected content-type KS_C_5601-1987
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Diggin/Http/Charset/Detector/HtmlDetector.php b/src/Diggin/Http/Charset/Detector/HtmlDetector.ph | |
index 4ed6dbd..ee1b543 100644 | |
--- a/src/Diggin/Http/Charset/Detector/HtmlDetector.php | |
+++ b/src/Diggin/Http/Charset/Detector/HtmlDetector.php | |
@@ -36,7 +36,11 @@ class HtmlDetector | |
private $_config = array('accept_header_ctype' => true, | |
'force_detect_body' => false, | |
- 'detect_prefer_mime' => false); | |
+ 'detect_prefer_mime' => false, | |
+ 'known_convert_targets' => array( | |
+ 'KS_C_5601-1987' => 'CP949', //strtoupper | |
+ ) | |
+ ); | |
/** | |
* configure | |
@@ -178,6 +182,11 @@ class HtmlDetector | |
//if ($wellknown = array_search($encoding, array('HZ-GB-2312' => 'GB-2312'))) { | |
// return $wellknown; | |
//} | |
+ | |
+ if (in_array(strtoupper($encoding), array_keys($this->_config['known_convert_targets']))) { | |
+ $encoding = $this->_config['known_convert_targets'][strtoupper($encoding)]; | |
+ } | |
+ | |
return $encoding; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment