"Brion Vibber" brion@pobox.com wrote:
Your text editor will have some sort of encoding setting. Use it.
Thanks for trying Brion.
However, in view of the actual problem though, this which you suggest is, sorry to say, complete nonsense. The whole idea is that the page is created via a PROGRAM and not via the browser, so browser settings are totally irrelevant. Sure, the page needs to be visible correctly in a browser afterwards, but it should not be for the end user to try and fudge the browser to some bizarre setting just because a letter "e" has a simple accent.
If you look at the sample code you will see the sample text which causes a problem:
$pageText = "Fédération";
It is not complex text. It is not as if I am trying to input Chinese via a program into a wiki.
If you think that the code, being PHP, still has to be run by a browser, ask the question how could such code as shown in the sample run and generate correct output.when the PHP program is run from the command line.
To reiterate, how can I get the following simple program to correctly create wiki pages with the accents correctly:
<?
require_once("../includes/Article.php"); require_once("../includes/Title.php"); require_once("../includes/EditPage.php"); require_once("../includes/GlobalFunctions.php");
/** * Test page creation */ function pageCreate() { global $wgLoadBalancer; global $wgUser;
// Create the page text $pageText = "Fédération"; $wikiPageName = "Page Test 1";
// Code adapted from "maintenance/InitialiseMessages.inc" $dbw =& wfGetDB( DB_MASTER );
$title = new Title(); $title = $title->newFromText($wikiPageName);
$article = new Article( $title ); $newid = $article->insertOn( $dbw, 'sysop' );
$revision = new Revision( array( 'page' => $newid, 'text' => $pageText, 'user' => 0, 'user_text' => "My user text", 'comment' => '', ) ); $revid = $revision->insertOn( $dbw ); $article->updateRevisionOn( $dbw, $revision );
$dbw->commit();
}
// Call the page creation pageCreate();
?>