We’ve got it working now! It required a combination of a few things. Bear in mind I'm neither a PHP developer nor someone who is particularly au fait with Linux, so treat the advice below with caution. And some of this is Oracle-specific, which might not be of use to you…
To use non-ASCII characters with a Moodle username, enable the following setting in Moodle:
Administration > Security > Site policies > check Allow extended characters in usernames
Enable UTF-8 in PHP
Edit /etc/php5/apache2/php.ini so that the default character set is UTF-8; alter:
;default_charset = "iso-8859-1"
to
default_charset = "utf-8"
For Oracle, once the Instant Client is installed, add the following environment variables:
Create the file /etc/profile.d/oracle.sh. Include the contents:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/oracle/instantclient_11_2
NLS_LANG=ENGLISH_UNITED\ KINGDOM.AL32UTF8
ORACLE_HOME=/opt/oracle/instantclient_11_2
PATH=$PATH:/opt/oracle/instantclient_11_2
Make the file executable with:
sudo chmod a+x oracle.sh
Export the environment variables so they are available to Apache/PHP. Append to the file /etc/apache2/envvars:
export NLS_LANG=ENGLISH_UNITED\ KINGDOM.AL32UTF8
export ORACLE_HOME=/opt/oracle/instantclient_11_2
Note: simply using export NLS_LANG appears to be insufficient, as the environment variables that exist on the command line aren't available to PHP by just exporting them. They must be both exported and initialised (to the correct value).
Hope this helps someone out there.