[PATCH] mb_convert_encoding() can not convert WINDOWS-1257 #1004

Closed
rcubetrac opened this Issue Mar 20, 2007 · 6 comments

Projects

None yet

1 participant

@rcubetrac

Reported by artis on 20 Mar 2007 14:52 UTC as Trac ticket #1484292

$from = "WINDOWS-1257"[= "UTF-8"

Illegal character encoding specified in program/include/main.inc on line 947

[PATCH]([BR]]
$to)
/trunk/roundcubemail/program/include/main.inc
line: 939

    $to = $to=="UTF-7" ? "UTF7-IMAP" : $to;
+   $from = $from=="WINDOWS-1257" ? "ISO-8859-13" : $from;
    $from = $from=="UTF-7" ? "UTF7-IMAP": $from;

Migrated-From: http://trac.roundcube.net/ticket/1484292

@rcubetrac

Comment by @thomascube on 28 Mar 2007 06:47 UTC

Probably the same issue with Windows-1250 (#1484225)

@rcubetrac

Milestone changed by @thomascube on 28 Mar 2007 06:47 UTC

=> 0.1-rc2

@rcubetrac

Comment by artis on 29 Mar 2007 07:39 UTC

iconv() can convert WINDOWS-1257 and WINDOWS-1250 and all other encodings what mbstrings can not.

function rcube_charset_convert() first try to detect if mbstring is present and use it. Then it look for iconv function and use it if present.

how about reverse?

  // convert charset using iconv module
  if (function_exists('iconv') && $from!='UTF-7' && $to!='UTF-7')
    return iconv($from, $to, $str);

  // convert charset using mbstring module
  if ($MBSTRING)
    {
    $to = $to=="UTF-7" ? "UTF7-IMAP" : $to;
    $from = $from=="UTF-7" ? "UTF7-IMAP": $from;

    // return if convert succeeded
    if (($out = mb_convert_encoding($str, $to, $from)) != '')
      return $out;
    }
@rcubetrac

Comment by artis on 29 Mar 2007 07:46 UTC

Same issue with WINDOWS-1256 (#1484064)

@rcubetrac

Comment by @thomascube on 10 Aug 2007 16:40 UTC

Applied to trunk in b8e65ce

@rcubetrac

Status changed by @thomascube on 10 Aug 2007 16:40 UTC

new => closed

@rcubetrac rcubetrac closed this Aug 10, 2007
@rcubetrac rcubetrac added this to the 0.1-rc2 milestone Mar 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment