Special:Import will eat all ampersands!
Do not use Special:Import unless you want your imports damaged.
Same problem for importDump.php.
Your file will not make the round trip Special:Export ->
Special:Import unscathed! importTextFile.php is safe though.
Proof:
Make a page called [[Test]] whose wikitext is:
1&2&[http://x.y/bla?o&p=q&r=s&v=t ooo]
Then run this shell script:
site=http://my.example.com
POST "$site/index.php?title=Special:Export&action=submit" <<EOF|tee 1.xml|sed s/Test/Test2/ > 2.xml
catname=&nsindex=0&pages=Test&curonly=1&wpDownload=1
EOF
diff -U0 [12].xml
#Then import 2.xml via Special:Import or importDump.php. Then
for i in '' 2
do GET "$site/index.php?title=Test$i&action=raw"; echo
done
You will see:
- <title>Test</title>
+ <title>Test2</title>
1&2&[http://x.y/bla?o&p=q&r=s&v=t ooo]
12amp;[http://x.y/bla?op=qr=samp;v=t ooo]
The last line is the mangled result.
Tested on a wiki with $wgLanguageCode='zh-tw'. Probably affects en too.
Version: 1.15.x
Severity: normal