[OAI-implementers] SPECIAL CHARACTERS...

Marina Muilwijk m.muilwijk@library.uu.nl
Fri, 27 Sep 2002 15:46:30 +0200


On 27 Sep 2002 at 10:06, Ramon Martins Sodoma da Fonseca wrote:

> We are having problems with the character encoding.
> We need to display special charaters, like ", , ", and others, and
> our question is:

We use Perl's sprintf function. For instance:
$creators =~ s/([^<>:a-zA-Z, .\/-])/sprintf "&#x%04X;", ord($1)/ei;

which converts everything but the characters within brackets to their 
hexadecimal value and adds the "&#X" required for Unicode encoding.