|Perl: the Markov chain saw|
encoding of file namesby amir_e_a (Hermit)
|on Mar 25, 2010 at 19:44 UTC||Need Help??|
amir_e_a has asked for the
wisdom of the Perl Monks concerning the following question:
I have a problem with encoding of file names on Ubuntu.
I am using glob to get a list of file names that include a certain string, slurp each file's contents to a variable, remove the file's extension using s///, and then i am trying to use MediaWiki::API->edit to upload the contents to a Wikipedia page whose title is the file's name without the extension. The file name and its contents include Hebrew characters; the content is utf8, but i am not sure about the file name.
The content comes out correctly at the target page, but the the page title is gibberish. What can i do to make the file name proper utf8, as the file's content?
Here's the relevant code:
If i just give a literal Hebrew string as the title parameter to $mw->edit, then everything works correctly. What can i do with $pagename so it will be encoded the same way as $text?
Thanks in advance.
Version: Perl 5.10 on Ubuntu 9.10.