I think it isn't nonsense actually.
Mediawiki is UTF8. UTF8 has no problem with plain ASCII as long as it's in
the common English subset.
Latin_1 characters are not transparent to this. If you edit your PHP with an
ASCII editor, it won't be proper UTF8.
To be on the safe side, since I don't know which platform you're running, my
humble advice is to try jEdit (java) and change the buffer encoding setting
to UTF-8.
(just load, change the buffer settings to UTF8, and save again. You can save
to a different file and see how they're not binary-identical) - Utilities >>
Buffer Options >> Character Encoding
Hope that helps.
On 2/6/06, Hugh Prior <mediawiki(a)localpin.com> wrote:
"Brion Vibber" <brion(a)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();
?>
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l