Commit 0ebd9c98 authored by stimpy's avatar stimpy

added iconv compatibility checks

parent 511c224c
......@@ -213,8 +213,12 @@
$chrs = 'CP437';
break;
}
if ( $chrs != 'UTF-8' ) $msg['SUBJECT'][0] = iconv( $chrs, 'UTF-8', $msg['SUBJECT'][0] );
if ( $chrs != 'UTF-8' ) {
if ( ( $msg['SUBJECT'][0] = @iconv( $chrs, 'UTF-8', $msg['SUBJECT'][0] ) ) === false ) {
$msg['SUBJECT'][0] = $msg['SUBJECT'][0];
}
}
//if ( $chrs != 'UTF-8' ) $msg['SUBJECT'][0] = iconv( $chrs, 'UTF-8', $msg['SUBJECT'][0] );
$ret[] = $msg;
}
}
......@@ -273,7 +277,13 @@
$fp = fopen( $filename .'.jdt', 'rb' );
if ( flock( $fp, LOCK_SH ) ) {
fseek( $fp, $ret['header']['offset'] );
$ret['text'] = iconv( $chrs, 'UTF-8', fread( $fp, $ret['header']['txtlen'] ) );
$ret['text'] = fread( $fp, $ret['header']['txtlen'] );
if ( $chrs != 'UTF-8' ) {
if ( ( $ret['text'] = @iconv( $chrs, 'UTF-8', $ret['text'] ) ) === false ) {
$ret['text'] = $ret['text'];
}
}
//$ret['text'] = iconv( $chrs, 'UTF-8', fread( $fp, $ret['header']['txtlen'] ) );
fflush( $fp );
flock( $fp, LOCK_UN );
} else {
......
......@@ -213,8 +213,12 @@
$chrs = 'CP437';
break;
}
if ( $chrs != 'UTF-8' ) $msg['SUBJECT'][0] = iconv( $chrs, 'UTF-8', $msg['SUBJECT'][0] );
if ( $chrs != 'UTF-8' ) {
if ( ( $msg['SUBJECT'][0] = @iconv( $chrs, 'UTF-8', $msg['SUBJECT'][0] ) ) === false ) {
$msg['SUBJECT'][0] = $msg['SUBJECT'][0];
}
}
//if ( $chrs != 'UTF-8' ) $msg['SUBJECT'][0] = iconv( $chrs, 'UTF-8', $msg['SUBJECT'][0] );
$ret[] = $msg;
}
}
......@@ -273,7 +277,13 @@
$fp = fopen( $filename .'.jdt', 'rb' );
if ( flock( $fp, LOCK_SH ) ) {
fseek( $fp, $ret['header']['offset'] );
$ret['text'] = iconv( $chrs, 'UTF-8', fread( $fp, $ret['header']['txtlen'] ) );
$ret['text'] = fread( $fp, $ret['header']['txtlen'] );
if ( $chrs != 'UTF-8' ) {
if ( ( $ret['text'] = @iconv( $chrs, 'UTF-8', $ret['text'] ) ) === false ) {
$ret['text'] = $ret['text'];
}
}
//$ret['text'] = iconv( $chrs, 'UTF-8', fread( $fp, $ret['header']['txtlen'] ) );
fflush( $fp );
flock( $fp, LOCK_UN );
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment