Hi all!
My setup:
MediaWiki 1.19.3
PHP 5.4.16
SMW 1.8.0.1
SRF 1.8
I'm currently implementing the vCard-Export in a wiki. The export itself
works fine but character encoding of the output .vcf is UTF-8. The character
encoding of the file must be windows-1252 or iso-8859-1, though, that it can
be opened by MS Outlook. Further, I think I found the corresponding part in
the SMW_ExportPrinter.php:
public function outputAsFile( SMWQueryResult $queryResult,
array $params ) {
$result = $this->getResult( $queryResult,
$params, SMW_OUTPUT_FILE );
header( 'Content-type: ' .
$this->getMimeType( $queryResult ) . '; charset=UTF-8' );
$fileName = $this->getFileName( $queryResult
);
if ( $fileName !== false ) {
header( "content-disposition:
attachment; filename=$fileName" );
}
echo $result;
}
My understanding of this code is that all files will be encoded in UTF-8.
Hence, I modified the function so that the charset (only) for vCards is
iso-8859-1. (The string 'text/x-vcard' is copied from SRF_vCard.php which
constructs the attachment.)
public function outputAsFile( SMWQueryResult $queryResult,
array $params ) {
$result = $this->getResult( $queryResult,
$params, SMW_OUTPUT_FILE );
if ( $this->getMimeType( $queryResult ) ==
'text/x-vcard') {
header( 'Content-type:
text/x-vcard; charset=iso-8859-1' );
} else {
header( 'Content-type: ' .
$this->getMimeType( $queryResult ) . '; charset=utf-8' );
}
$fileName = $this->getFileName( $queryResult
);
if ( $fileName !== false ) {
header( "content-disposition:
attachment; filename=$fileName" );
}
echo $result;
}
It isn't beautiful but it should do the trick.
Okay, so here's my problem: It doesn't do anything. Any changes I make
simply do not have an effect on the output. Even gibberish doesn't produce
error massages. The .vcf output still works and the encoding is UTF-8.
My questions are:
Am I on the right track? Is this really the important part of the code?
Where should I look instead?
Many thanks in advance! This bug is haunting me for a week now. =)
Thomas
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel