Skip to content

Instantly share code, notes, and snippets.

@nemf
Created December 13, 2013 03:05
Show Gist options
  • Save nemf/7939261 to your computer and use it in GitHub Desktop.
Save nemf/7939261 to your computer and use it in GitHub Desktop.
ISO-2022-JP-MS patch for roundcube 0.94
--- rcube_charset.php.org 2013-09-06 21:20:49.000000000 +0900
+++ rcube_charset.php 2013-12-13 11:27:54.000000000 +0900
@@ -177,6 +177,7 @@
static $mbstring_sch = null;
static $conv = null;
+ if(strcasecmp('iso-2022-jp', $from)===0) $from = 'ISO-2022-JP-MS';
$to = empty($to) ? RCUBE_CHARSET : $to;
$from = self::parse_charset($from);
@@ -239,7 +240,10 @@
// return if encoding found, string matches encoding and convert succeeded
if (in_array($mb_from, $mbstring_list) && in_array($mb_to, $mbstring_list)) {
- if (mb_check_encoding($str, $mb_from)) {
+ // if (mb_check_encoding($str, $mb_from)) {
+ if (mb_check_encoding($str, $mb_from) ||
+ strcasecmp('ISO-2022-JP-MS', mb_detect_encoding($str, $mb_from))===0
+ ) {
// Do the same as //IGNORE with iconv
mb_substitute_character('none');
$out = mb_convert_encoding($str, $mb_to, $mb_from);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment