logo
Published on john.parnefjord.se (http://john.parnefjord.se)

PHP5, CAS, UTF-8 and authentication error

By johnp
Created 2009-06-22 11:12

At work we use Xerxes [1], a metasearch engine that relies on the Xserver shipper with ExLibris' Metalib. Xerxes is developed by David Walker at the California State University.

As a user in Xerxes you can login and save your favorite databases and articles. Our choice of authentication is CAS, Central Authentication Service [2]. To get setup CAS authentication you just have to make the necessary configuration changes, no big deal. But unfortunately we experienced som strange errors where users couldn't be authenticated. After digging around I found out that the headers sent by PHP must be encoded using UTF-8. Checking the code was futile, it was correctly encoded in UTF-8.

After some further excavation, down in the trenches, I checked out the php.ini file. To my surprise the default encoding used by PHP is still set to ISO-8859-1, not UTF-8, in Ubuntu 8.04. LTS. Changing/adding the following line in php.ini finally did the trick.

default_charset         = "UTF-8"

There is probably a reason why ISO Latin is still used as default encoding, but why not use the same encoding as the OS uses?

 


Source URL:
http://john.parnefjord.se/node/56